{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Setup"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 1,
   "metadata": {},
   "outputs": [],
   "source": [
    "# Seed the random number generator so that it will\n",
    "# produce the same set of random numbers. \n",
    "#\n",
    "# You don't generally need to do this, but it ensures\n",
    "# that you'll see exactly the same results we do for\n",
    "# this demo. \n",
    "srand(42);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WebIO: setting up mux\n"
     ]
    },
    {
     "data": {
      "text/html": [
       "    <script class='js-collapse-script'>\n",
       "        var curMatch =\n",
       "            window.location.href\n",
       "            .match(/(.*?)\\/notebooks\\/.*\\.ipynb/);\n",
       "\n",
       "        curMatch = curMatch ||\n",
       "            window.location.href\n",
       "            .match(/(.*?)\\/apps\\/.*\\.ipynb/);\n",
       "\n",
       "        if ( curMatch ) {\n",
       "            $('head').append('<base href=\"' + curMatch[1] + '/\">');\n",
       "        }\n",
       "    </script>\n"
      ],
      "text/plain": [
       "HTML{String}(\"    <script class='js-collapse-script'>\\n        var curMatch =\\n            window.location.href\\n            .match(/(.*?)\\\\/notebooks\\\\/.*\\\\.ipynb/);\\n\\n        curMatch = curMatch ||\\n            window.location.href\\n            .match(/(.*?)\\\\/apps\\\\/.*\\\\.ipynb/);\\n\\n        if ( curMatch ) {\\n            \\$('head').append('<base href=\\\"' + curMatch[1] + '/\\\">');\\n        }\\n    </script>\\n\")"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<script class='js-collapse-script' src='pkg/WebIO/webio/dist/bundle.js'></script>"
      ],
      "text/plain": [
       "HTML{String}(\"<script class='js-collapse-script' src='pkg/WebIO/webio/dist/bundle.js'></script>\")"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "<script class='js-collapse-script' src='pkg/WebIO/providers/ijulia_setup.js'></script>"
      ],
      "text/plain": [
       "HTML{String}(\"<script class='js-collapse-script' src='pkg/WebIO/providers/ijulia_setup.js'></script>\")"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "data": {
      "text/html": [
       "  <script class='js-collapse-script'>\n",
       "    $('.js-collapse-script').parent('.output_subarea').css('padding', '0');\n",
       "  </script>\n"
      ],
      "text/plain": [
       "HTML{String}(\"  <script class='js-collapse-script'>\\n    \\$('.js-collapse-script').parent('.output_subarea').css('padding', '0');\\n  </script>\\n\")"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "WebIO: setting up ijulia\n"
     ]
    }
   ],
   "source": [
    "using RigidBodyDynamics\n",
    "using Plots\n",
    "using MeshCatMechanisms\n",
    "using Base.Test"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Creating, simulating, and visualizing a double pendulum `Mechanism`\n",
    "\n",
    "We're going to create a simple `Mechanism` that represents a [double pendulum](https://en.wikipedia.org/wiki/Double_pendulum).\n",
    "One way of creating a `Mechanism` is by parsing a [URDF](http://wiki.ros.org/urdf) file:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Spanning tree:\n",
       "Vertex: world (root)\n",
       "  Vertex: base_link, Edge: base_link_to_world\n",
       "    Vertex: upper_link, Edge: shoulder\n",
       "      Vertex: lower_link, Edge: elbow\n",
       "No non-tree joints."
      ]
     },
     "execution_count": 3,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "urdf = \"data/doublependulum.urdf\"\n",
    "doublependulum = parse_urdf(Float64, urdf)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A `Mechanism` stores the joint/rigid body layout, but no state information. State information is separated out into a `MechanismState` object:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "MechanismState{Float64, Float64, Float64, …}(…)"
      ]
     },
     "execution_count": 4,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "const state = MechanismState(doublependulum)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Next, we'll visualize the double pendulum using MeshCat (a web-enabled 3D viewer): "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 5,
   "metadata": {},
   "outputs": [],
   "source": [
    "vis = MechanismVisualizer(doublependulum, URDFVisuals(urdf));"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To open the visualizer in a new tab, just do: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "metadata": {},
   "outputs": [],
   "source": [
    "# open(vis)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "MeshCat even allows us to embed a visualizer inside the jupyter notebook: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 7,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div class='display:none'></div><unsafe-script style='display:none'>\n",
       "WebIO.mount(this.previousSibling,{&quot;props&quot;:{},&quot;nodeType&quot;:&quot;Scope&quot;,&quot;type&quot;:&quot;node&quot;,&quot;instanceArgs&quot;:{&quot;imports&quot;:{&quot;data&quot;:[],&quot;type&quot;:&quot;async_block&quot;},&quot;id&quot;:&quot;scope-0552ca24-13b2-4fa3-80f6-1f11a7394864&quot;,&quot;handlers&quot;:{&quot;_promises&quot;:{&quot;importsLoaded&quot;:[function () {\n",
       "    var frame = this.dom.querySelector(&quot;#ifr&quot;);\n",
       "    var doc = frame.contentDocument\n",
       "    var win = frame.contentWindow\n",
       "\n",
       "    // Determine if we&#39;re running on a Jupyter hosting service\n",
       "    // that requires a base URL when retrieving assets\n",
       "    var curMatch =\n",
       "        window.location.href\n",
       "        .match(/(.*?)\\/notebooks\\/.*\\.ipynb/);\n",
       "    curMatch = curMatch ||\n",
       "        window.location.href\n",
       "        .match(/(.*?)\\/apps\\/.*\\.ipynb/);\n",
       "    if (curMatch) {\n",
       "        var base = doc.createElement(&quot;base&quot;);\n",
       "        base.setAttribute(&quot;href&quot;, curMatch[1] + &#39;/&#39;);\n",
       "        doc.head.appendChild(base);\n",
       "    }\n",
       "\n",
       "    var webio = doc.createElement(&quot;script&quot;)\n",
       "    webio.src = &quot;pkg/WebIO/webio/dist/bundle.js&quot;\n",
       "    var parent = window\n",
       "\n",
       "    function resizeIframe() {\n",
       "        doc.body.style.padding = &#39;0&#39;\n",
       "        doc.body.style.margin = &#39;0&#39;\n",
       "        doc.documentElement.height = &#39;100%&#39;\n",
       "        doc.body.height = &#39;100%&#39;\n",
       "    }\n",
       "\n",
       "    webio.onload = function () {\n",
       "        win.WebIO.sendCallback = parent.WebIO.sendCallback; // Share stuff\n",
       "        win.WebIO.scopes = parent.WebIO.scopes\n",
       "        win.WebIO.obsscopes = parent.WebIO.obsscopes\n",
       "        win.WebIO._connected = true\n",
       "        doc.body.innerHTML = &quot;&lt;html&gt;&lt;body&gt;&quot; + &quot;&lt;div class=&#39;display:none&#39;&gt;&lt;/div&gt;&lt;unsafe-script style=&#39;display:none&#39;&gt;\\nWebIO.mount(this.previousSibling,{&amp;quot;props&amp;quot;:{},&amp;quot;nodeType&amp;quot;:&amp;quot;Scope&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;node&amp;quot;,&amp;quot;instanceArgs&amp;quot;:{&amp;quot;imports&amp;quot;:{&amp;quot;data&amp;quot;:[{&amp;quot;name&amp;quot;:null,&amp;quot;type&amp;quot;:&amp;quot;js&amp;quot;,&amp;quot;url&amp;quot;:&amp;quot;pkg/MeshCat/meshcat/dist/main.min.js&amp;quot;}],&amp;quot;type&amp;quot;:&amp;quot;async_block&amp;quot;},&amp;quot;id&amp;quot;:&amp;quot;scope-ea0b3184-43b4-4e0c-8d93-4871fb64f900&amp;quot;,&amp;quot;handlers&amp;quot;:{&amp;quot;meshcat-command&amp;quot;:[(function (val){return this.viewer.handle_command_message({&amp;quot;data&amp;quot;:val})})],&amp;quot;_promises&amp;quot;:{&amp;quot;importsLoaded&amp;quot;:[(function (mc){var element=this.dom.children[0]; this.viewer=new mc.Viewer(element); WebIO.setval({&amp;quot;name&amp;quot;:&amp;quot;meshcat-request&amp;quot;,&amp;quot;scope&amp;quot;:&amp;quot;scope-ea0b3184-43b4-4e0c-8d93-4871fb64f900&amp;quot;,&amp;quot;id&amp;quot;:&amp;quot;ob_02&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;observable&amp;quot;},String(Date.now())); return window.document.body.style.margin=&amp;quot;0&amp;quot;})]}},&amp;quot;systemjs_options&amp;quot;:null,&amp;quot;observables&amp;quot;:{&amp;quot;meshcat-command&amp;quot;:{&amp;quot;sync&amp;quot;:false,&amp;quot;id&amp;quot;:&amp;quot;ob_01&amp;quot;,&amp;quot;value&amp;quot;:[131,166,109,97,116,114,105,120,199,64,23,0,0,128,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,63,0,0,0,0,0,0,0,0,205,204,204,61,0,0,128,191,0,0,128,63,164,116,121,112,101,173,115,101,116,95,116,114,97,110,115,102,111,114,109,164,112,97,116,104,218,0,46,47,109,101,115,104,99,97,116,47,119,111,114,108,100,47,98,97,115,101,95,108,105,110,107,47,117,112,112,101,114,95,108,105,110,107,47,108,111,119,101,114,95,108,105,110,107]},&amp;quot;meshcat-controls&amp;quot;:{&amp;quot;sync&amp;quot;:true,&amp;quot;id&amp;quot;:&amp;quot;ob_03&amp;quot;,&amp;quot;value&amp;quot;:[]},&amp;quot;meshcat-request&amp;quot;:{&amp;quot;sync&amp;quot;:true,&amp;quot;id&amp;quot;:&amp;quot;ob_02&amp;quot;,&amp;quot;value&amp;quot;:&amp;quot;&amp;quot;}}},&amp;quot;children&amp;quot;:[{&amp;quot;props&amp;quot;:{&amp;quot;className&amp;quot;:&amp;quot;meshcat-viewer&amp;quot;,&amp;quot;style&amp;quot;:{&amp;quot;left&amp;quot;:0,&amp;quot;right&amp;quot;:0,&amp;quot;overflow&amp;quot;:&amp;quot;hidden&amp;quot;,&amp;quot;position&amp;quot;:&amp;quot;absolute&amp;quot;,&amp;quot;height&amp;quot;:&amp;quot;100vh&amp;quot;,&amp;quot;margin&amp;quot;:0,&amp;quot;width&amp;quot;:&amp;quot;100vw&amp;quot;}},&amp;quot;nodeType&amp;quot;:&amp;quot;DOM&amp;quot;,&amp;quot;type&amp;quot;:&amp;quot;node&amp;quot;,&amp;quot;instanceArgs&amp;quot;:{&amp;quot;namespace&amp;quot;:&amp;quot;html&amp;quot;,&amp;quot;tag&amp;quot;:&amp;quot;div&amp;quot;},&amp;quot;children&amp;quot;:[]}]})&lt;/unsafe-script&gt;&quot; + &quot;&lt;/body&gt;&lt;/html&gt;&quot;;\n",
       "        setTimeout(function () { resizeIframe() }, 0)\n",
       "    }\n",
       "\n",
       "    doc.body.appendChild(webio)\n",
       "},(function (){return this.dom.style.height=&quot;100%&quot;})]}},&quot;systemjs_options&quot;:null,&quot;observables&quot;:{}},&quot;children&quot;:[{&quot;props&quot;:{&quot;style&quot;:{&quot;flexDirection&quot;:&quot;column&quot;,&quot;height&quot;:&quot;100%&quot;,&quot;minHeight&quot;:&quot;400px&quot;,&quot;display&quot;:&quot;flex&quot;,&quot;width&quot;:&quot;100%&quot;,&quot;overflow&quot;:&quot;hidden&quot;}},&quot;nodeType&quot;:&quot;DOM&quot;,&quot;type&quot;:&quot;node&quot;,&quot;instanceArgs&quot;:{&quot;namespace&quot;:&quot;html&quot;,&quot;tag&quot;:&quot;div&quot;},&quot;children&quot;:[{&quot;props&quot;:{&quot;attributes&quot;:{&quot;height&quot;:&quot;100%&quot;,&quot;scrolling&quot;:&quot;no&quot;,&quot;src&quot;:&quot;javascript:void(0)&quot;,&quot;frameborder&quot;:0},&quot;id&quot;:&quot;ifr&quot;,&quot;style&quot;:{&quot;width&quot;:&quot;100%&quot;,&quot;flexGrow&quot;:&quot;1&quot;}},&quot;nodeType&quot;:&quot;DOM&quot;,&quot;type&quot;:&quot;node&quot;,&quot;instanceArgs&quot;:{&quot;namespace&quot;:&quot;html&quot;,&quot;tag&quot;:&quot;iframe&quot;},&quot;children&quot;:[]}]}]})</unsafe-script>"
      ],
      "text/plain": [
       "WebIO.Scope(\"scope-0552ca24-13b2-4fa3-80f6-1f11a7394864\", WebIO.Node{WebIO.DOM}(WebIO.DOM(:html, :div), Any[WebIO.Node{WebIO.DOM}(WebIO.DOM(:html, :iframe), Any[], Dict{Symbol,Any}(Pair{Symbol,Any}(:attributes, Dict{String,Any}(Pair{String,Any}(\"height\", \"100%\"),Pair{String,Any}(\"scrolling\", \"no\"),Pair{String,Any}(\"src\", \"javascript:void(0)\"),Pair{String,Any}(\"frameborder\", 0))),Pair{Symbol,Any}(:id, \"ifr\"),Pair{Symbol,Any}(:style, Dict(\"width\"=>\"100%\",\"flexGrow\"=>\"1\"))), 0)], Dict{Symbol,Any}(Pair{Symbol,Any}(:style, Dict(\"flexDirection\"=>\"column\",\"height\"=>\"100%\",\"minHeight\"=>\"400px\",\"display\"=>\"flex\",\"width\"=>\"100%\",\"overflow\"=>\"hidden\"))), 1), Dict{String,Tuple{Observables.Observable,Union{Bool, Void}}}(), Set{String}(), nothing, Any[], Dict{Any,Any}(Pair{Any,Any}(\"_promises\", Dict{Any,Any}(Pair{Any,Any}(\"importsLoaded\", Any[WebIO.JSString(\"function () {\\n    var frame = this.dom.querySelector(\\\"#ifr\\\");\\n    var doc = frame.contentDocument\\n    var win = frame.contentWindow\\n\\n    // Determine if we're running on a Jupyter hosting service\\n    // that requires a base URL when retrieving assets\\n    var curMatch =\\n        window.location.href\\n        .match(/(.*?)\\\\/notebooks\\\\/.*\\\\.ipynb/);\\n    curMatch = curMatch ||\\n        window.location.href\\n        .match(/(.*?)\\\\/apps\\\\/.*\\\\.ipynb/);\\n    if (curMatch) {\\n        var base = doc.createElement(\\\"base\\\");\\n        base.setAttribute(\\\"href\\\", curMatch[1] + '/');\\n        doc.head.appendChild(base);\\n    }\\n\\n    var webio = doc.createElement(\\\"script\\\")\\n    webio.src = \\\"pkg/WebIO/webio/dist/bundle.js\\\"\\n    var parent = window\\n\\n    function resizeIframe() {\\n        doc.body.style.padding = '0'\\n        doc.body.style.margin = '0'\\n        doc.documentElement.height = '100%'\\n        doc.body.height = '100%'\\n    }\\n\\n    webio.onload = function () {\\n        win.WebIO.sendCallback = parent.WebIO.sendCallback; // Share stuff\\n        win.WebIO.scopes = parent.WebIO.scopes\\n        win.WebIO.obsscopes = parent.WebIO.obsscopes\\n        win.WebIO._connected = true\\n        doc.body.innerHTML = \\\"<html><body>\\\" + \\\"<div class='display:none'></div><unsafe-script style='display:none'>\\\\nWebIO.mount(this.previousSibling,{&quot;props&quot;:{},&quot;nodeType&quot;:&quot;Scope&quot;,&quot;type&quot;:&quot;node&quot;,&quot;instanceArgs&quot;:{&quot;imports&quot;:{&quot;data&quot;:[{&quot;name&quot;:null,&quot;type&quot;:&quot;js&quot;,&quot;url&quot;:&quot;pkg/MeshCat/meshcat/dist/main.min.js&quot;}],&quot;type&quot;:&quot;async_block&quot;},&quot;id&quot;:&quot;scope-ea0b3184-43b4-4e0c-8d93-4871fb64f900&quot;,&quot;handlers&quot;:{&quot;meshcat-command&quot;:[(function (val){return this.viewer.handle_command_message({&quot;data&quot;:val})})],&quot;_promises&quot;:{&quot;importsLoaded&quot;:[(function (mc){var element=this.dom.children[0]; this.viewer=new mc.Viewer(element); WebIO.setval({&quot;name&quot;:&quot;meshcat-request&quot;,&quot;scope&quot;:&quot;scope-ea0b3184-43b4-4e0c-8d93-4871fb64f900&quot;,&quot;id&quot;:&quot;ob_02&quot;,&quot;type&quot;:&quot;observable&quot;},String(Date.now())); return window.document.body.style.margin=&quot;0&quot;})]}},&quot;systemjs_options&quot;:null,&quot;observables&quot;:{&quot;meshcat-command&quot;:{&quot;sync&quot;:false,&quot;id&quot;:&quot;ob_01&quot;,&quot;value&quot;:[131,166,109,97,116,114,105,120,199,64,23,0,0,128,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,63,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,128,63,0,0,0,0,0,0,0,0,205,204,204,61,0,0,128,191,0,0,128,63,164,116,121,112,101,173,115,101,116,95,116,114,97,110,115,102,111,114,109,164,112,97,116,104,218,0,46,47,109,101,115,104,99,97,116,47,119,111,114,108,100,47,98,97,115,101,95,108,105,110,107,47,117,112,112,101,114,95,108,105,110,107,47,108,111,119,101,114,95,108,105,110,107]},&quot;meshcat-controls&quot;:{&quot;sync&quot;:true,&quot;id&quot;:&quot;ob_03&quot;,&quot;value&quot;:[]},&quot;meshcat-request&quot;:{&quot;sync&quot;:true,&quot;id&quot;:&quot;ob_02&quot;,&quot;value&quot;:&quot;&quot;}}},&quot;children&quot;:[{&quot;props&quot;:{&quot;className&quot;:&quot;meshcat-viewer&quot;,&quot;style&quot;:{&quot;left&quot;:0,&quot;right&quot;:0,&quot;overflow&quot;:&quot;hidden&quot;,&quot;position&quot;:&quot;absolute&quot;,&quot;height&quot;:&quot;100vh&quot;,&quot;margin&quot;:0,&quot;width&quot;:&quot;100vw&quot;}},&quot;nodeType&quot;:&quot;DOM&quot;,&quot;type&quot;:&quot;node&quot;,&quot;instanceArgs&quot;:{&quot;namespace&quot;:&quot;html&quot;,&quot;tag&quot;:&quot;div&quot;},&quot;children&quot;:[]}]})</unsafe-script>\\\" + \\\"</body></html>\\\";\\n        setTimeout(function () { resizeIframe() }, 0)\\n    }\\n\\n    doc.body.appendChild(webio)\\n}\"), WebIO.JSString(\"(function (){return this.dom.style.height=\\\"100%\\\"})\")])))), WebIO.ConnectionPool(Channel{Any}(sz_max:9223372036854775807,sz_curr:0), Set{WebIO.AbstractConnection}(), Channel{WebIO.AbstractConnection}(sz_max:32,sz_curr:0)))"
      ]
     },
     "execution_count": 7,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "IJuliaCell(vis)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Let's first set the configurations and velocities of the joints:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 8,
   "metadata": {},
   "outputs": [],
   "source": [
    "set_configuration!(state, [1.0, -1.5])\n",
    "set_configuration!(vis, configuration(state))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Basic simulation is easy (but see RigidBodySim.jl for a more featureful simulator):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 9,
   "metadata": {},
   "outputs": [],
   "source": [
    "ts, qs, vs = simulate(state, 5., Δt = 1e-3);"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "After which we can animate the results:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {},
   "outputs": [],
   "source": [
    "MeshCatMechanisms.animate(vis, ts, qs)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Or plot them using e.g. Plots.jl:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 11,
   "metadata": {
    "scrolled": false
   },
   "outputs": [
    {
     "data": {
      "image/svg+xml": [
       "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n",
       "<svg xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" width=\"600\" height=\"400\" viewBox=\"0 0 600 400\">\n",
       "<defs>\n",
       "  <clipPath id=\"clip4000\">\n",
       "    <rect x=\"0\" y=\"0\" width=\"600\" height=\"400\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polygon clip-path=\"url(#clip4000)\" points=\"\n",
       "0,400 600,400 600,0 0,0 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip4001\">\n",
       "    <rect x=\"120\" y=\"0\" width=\"421\" height=\"400\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polygon clip-path=\"url(#clip4000)\" points=\"\n",
       "55.25,360.121 580.315,360.121 580.315,11.811 55.25,11.811 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<defs>\n",
       "  <clipPath id=\"clip4002\">\n",
       "    <rect x=\"55\" y=\"11\" width=\"526\" height=\"349\"/>\n",
       "  </clipPath>\n",
       "</defs>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  55.25,360.121 55.25,11.811 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  160.263,360.121 160.263,11.811 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  265.276,360.121 265.276,11.811 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  370.289,360.121 370.289,11.811 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  475.302,360.121 475.302,11.811 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  580.315,360.121 580.315,11.811 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  55.25,274.365 580.315,274.365 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  55.25,186.847 580.315,186.847 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  55.25,99.329 580.315,99.329 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#000000; stroke-width:0.5; stroke-opacity:0.1; fill:none\" points=\"\n",
       "  55.25,11.811 580.315,11.811 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  55.25,360.121 580.315,360.121 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  55.25,360.121 55.25,11.811 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  55.25,360.121 55.25,354.896 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  160.263,360.121 160.263,354.896 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  265.276,360.121 265.276,354.896 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  370.289,360.121 370.289,354.896 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  475.302,360.121 475.302,354.896 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  580.315,360.121 580.315,354.896 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  55.25,274.365 63.126,274.365 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  55.25,186.847 63.126,186.847 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  55.25,99.329 63.126,99.329 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  55.25,11.811 63.126,11.811 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 55.25, 373.921)\" x=\"55.25\" y=\"373.921\">0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 160.263, 373.921)\" x=\"160.263\" y=\"373.921\">1</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 265.276, 373.921)\" x=\"265.276\" y=\"373.921\">2</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 370.289, 373.921)\" x=\"370.289\" y=\"373.921\">3</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 475.302, 373.921)\" x=\"475.302\" y=\"373.921\">4</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:middle;\" transform=\"rotate(0, 580.315, 373.921)\" x=\"580.315\" y=\"373.921\">5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;\" transform=\"rotate(0, 49.25, 278.865)\" x=\"49.25\" y=\"278.865\">-0.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;\" transform=\"rotate(0, 49.25, 191.347)\" x=\"49.25\" y=\"191.347\">0.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;\" transform=\"rotate(0, 49.25, 103.829)\" x=\"49.25\" y=\"103.829\">0.5</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:end;\" transform=\"rotate(0, 49.25, 16.311)\" x=\"49.25\" y=\"16.311\">1.0</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:16; text-anchor:middle;\" transform=\"rotate(0, 317.783, 397.6)\" x=\"317.783\" y=\"397.6\">Time [s]</text>\n",
       "</g>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:16; text-anchor:middle;\" transform=\"rotate(-90, 14.4, 185.966)\" x=\"14.4\" y=\"185.966\">Angle [rad]</text>\n",
       "</g>\n",
       "<polyline clip-path=\"url(#clip4002)\" style=\"stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  55.25,11.811 55.3551,11.8119 55.4601,11.8144 55.5651,11.8185 55.6701,11.8243 55.7751,11.8318 55.8801,11.841 55.9851,11.8518 56.0902,11.8643 56.1952,11.8784 \n",
       "  56.3002,11.8942 56.4052,11.9117 56.5102,11.9308 56.6152,11.9516 56.7202,11.974 56.8252,11.9982 56.9303,12.024 57.0353,12.0514 57.1403,12.0805 57.2453,12.1113 \n",
       "  57.3503,12.1437 57.4553,12.1778 57.5603,12.2136 57.6653,12.251 57.7704,12.2901 57.8754,12.3309 57.9804,12.3733 58.0854,12.4174 58.1904,12.4632 58.2954,12.5106 \n",
       "  58.4004,12.5597 58.5054,12.6104 58.6105,12.6629 58.7155,12.7169 58.8205,12.7727 58.9255,12.8301 59.0305,12.8892 59.1355,12.9499 59.2405,13.0123 59.3456,13.0764 \n",
       "  59.4506,13.1422 59.5556,13.2096 59.6606,13.2787 59.7656,13.3494 59.8706,13.4218 59.9756,13.4959 60.0806,13.5716 60.1857,13.649 60.2907,13.7281 60.3957,13.8089 \n",
       "  60.5007,13.8913 60.6057,13.9754 60.7107,14.0611 60.8157,14.1486 60.9207,14.2377 61.0258,14.3284 61.1308,14.4208 61.2358,14.5149 61.3408,14.6107 61.4458,14.7082 \n",
       "  61.5508,14.8073 61.6558,14.9081 61.7609,15.0105 61.8659,15.1146 61.9709,15.2204 62.0759,15.3279 62.1809,15.4371 62.2859,15.5479 62.3909,15.6604 62.4959,15.7745 \n",
       "  62.601,15.8904 62.706,16.0079 62.811,16.1271 62.916,16.2479 63.021,16.3705 63.126,16.4947 63.231,16.6206 63.336,16.7482 63.4411,16.8774 63.5461,17.0083 \n",
       "  63.6511,17.141 63.7561,17.2752 63.8611,17.4112 63.9661,17.5488 64.0711,17.6882 64.1761,17.8292 64.2812,17.9719 64.3862,18.1162 64.4912,18.2623 64.5962,18.41 \n",
       "  64.7012,18.5595 64.8062,18.7106 64.9112,18.8634 65.0163,19.0178 65.1213,19.174 65.2263,19.3319 65.3313,19.4914 65.4363,19.6526 65.5413,19.8156 65.6463,19.9802 \n",
       "  65.7513,20.1465 65.8564,20.3145 65.9614,20.4842 66.0664,20.6556 66.1714,20.8286 66.2764,21.0034 66.3814,21.1799 66.4864,21.358 66.5914,21.5379 66.6965,21.7195 \n",
       "  66.8015,21.9027 66.9065,22.0877 67.0115,22.2744 67.1165,22.4628 67.2215,22.6528 67.3265,22.8446 67.4316,23.0381 67.5366,23.2333 67.6416,23.4302 67.7466,23.6288 \n",
       "  67.8516,23.8292 67.9566,24.0312 68.0616,24.235 68.1666,24.4405 68.2717,24.6476 68.3767,24.8565 68.4817,25.0672 68.5867,25.2795 68.6917,25.4936 68.7967,25.7094 \n",
       "  68.9017,25.9269 69.0067,26.1461 69.1118,26.3671 69.2168,26.5898 69.3218,26.8143 69.4268,27.0404 69.5318,27.2683 69.6368,27.498 69.7418,27.7293 69.8469,27.9624 \n",
       "  69.9519,28.1973 70.0569,28.4339 70.1619,28.6722 70.2669,28.9123 70.3719,29.1542 70.4769,29.3978 70.5819,29.6431 70.687,29.8902 70.792,30.1391 70.897,30.3897 \n",
       "  71.002,30.6421 71.107,30.8962 71.212,31.1521 71.317,31.4098 71.422,31.6692 71.5271,31.9304 71.6321,32.1934 71.7371,32.4582 71.8421,32.7247 71.9471,32.9931 \n",
       "  72.0521,33.2632 72.1571,33.5351 72.2621,33.8088 72.3672,34.0843 72.4722,34.3616 72.5772,34.6406 72.6822,34.9215 72.7872,35.2042 72.8922,35.4887 72.9972,35.775 \n",
       "  73.1023,36.0631 73.2073,36.3531 73.3123,36.6448 73.4173,36.9384 73.5223,37.2338 73.6273,37.531 73.7323,37.8301 73.8373,38.131 73.9424,38.4337 74.0474,38.7383 \n",
       "  74.1524,39.0448 74.2574,39.353 74.3624,39.6632 74.4674,39.9752 74.5724,40.289 74.6774,40.6048 74.7825,40.9224 74.8875,41.2418 74.9925,41.5632 75.0975,41.8864 \n",
       "  75.2025,42.2115 75.3075,42.5385 75.4125,42.8674 75.5176,43.1982 75.6226,43.5309 75.7276,43.8655 75.8326,44.2021 75.9376,44.5405 76.0426,44.8809 76.1476,45.2232 \n",
       "  76.2526,45.5674 76.3577,45.9136 76.4627,46.2617 76.5677,46.6118 76.6727,46.9638 76.7777,47.3178 76.8827,47.6737 76.9877,48.0316 77.0927,48.3915 77.1978,48.7534 \n",
       "  77.3028,49.1173 77.4078,49.4831 77.5128,49.851 77.6178,50.2208 77.7228,50.5927 77.8278,50.9666 77.9329,51.3425 78.0379,51.7205 78.1429,52.1004 78.2479,52.4825 \n",
       "  78.3529,52.8666 78.4579,53.2527 78.5629,53.6409 78.6679,54.0312 78.773,54.4236 78.878,54.818 78.983,55.2145 79.088,55.6132 79.193,56.014 79.298,56.4168 \n",
       "  79.403,56.8218 79.508,57.229 79.6131,57.6382 79.7181,58.0497 79.8231,58.4632 79.9281,58.879 80.0331,59.2969 80.1381,59.717 80.2431,60.1394 80.3481,60.5639 \n",
       "  80.4532,60.9906 80.5582,61.4195 80.6632,61.8507 80.7682,62.2841 80.8732,62.7198 80.9782,63.1577 81.0832,63.5979 81.1883,64.0404 81.2933,64.4851 81.3983,64.9322 \n",
       "  81.5033,65.3816 81.6083,65.8333 81.7133,66.2873 81.8183,66.7437 81.9233,67.2024 82.0284,67.6635 82.1334,68.127 82.2384,68.5929 82.3434,69.0611 82.4484,69.5318 \n",
       "  82.5534,70.0049 82.6584,70.4805 82.7634,70.9585 82.8685,71.4389 82.9735,71.9219 83.0785,72.4073 83.1835,72.8952 83.2885,73.3857 83.3935,73.8786 83.4985,74.3741 \n",
       "  83.6036,74.8722 83.7086,75.3729 83.8136,75.8761 83.9186,76.3819 84.0236,76.8903 84.1286,77.4014 84.2336,77.9151 84.3386,78.4315 84.4437,78.9505 84.5487,79.4723 \n",
       "  84.6537,79.9967 84.7587,80.5239 84.8637,81.0538 84.9687,81.5864 85.0737,82.1219 85.1787,82.6601 85.2838,83.2011 85.3888,83.7449 85.4938,84.2916 85.5988,84.8411 \n",
       "  85.7038,85.3936 85.8088,85.9488 85.9138,86.5071 86.0189,87.0682 86.1239,87.6323 86.2289,88.1993 86.3339,88.7693 86.4389,89.3424 86.5439,89.9184 86.6489,90.4975 \n",
       "  86.7539,91.0796 86.859,91.6648 86.964,92.2532 87.069,92.8446 87.174,93.4392 87.279,94.0369 87.384,94.6378 87.489,95.2419 87.594,95.8492 87.6991,96.4598 \n",
       "  87.8041,97.0736 87.9091,97.6907 88.0141,98.3111 88.1191,98.9349 88.2241,99.5619 88.3291,100.192 88.4341,100.826 88.5392,101.463 88.6442,102.104 88.7492,102.748 \n",
       "  88.8542,103.396 88.9592,104.047 89.0642,104.701 89.1692,105.359 89.2743,106.021 89.3793,106.686 89.4843,107.355 89.5893,108.027 89.6943,108.703 89.7993,109.383 \n",
       "  89.9043,110.066 90.0093,110.754 90.1144,111.444 90.2194,112.139 90.3244,112.837 90.4294,113.539 90.5344,114.245 90.6394,114.954 90.7444,115.667 90.8494,116.385 \n",
       "  90.9545,117.106 91.0595,117.83 91.1645,118.559 91.2695,119.292 91.3745,120.028 91.4795,120.768 91.5845,121.513 91.6896,122.261 91.7946,123.013 91.8996,123.769 \n",
       "  92.0046,124.529 92.1096,125.292 92.2146,126.06 92.3196,126.832 92.4246,127.607 92.5297,128.387 92.6347,129.17 92.7397,129.957 92.8447,130.748 92.9497,131.543 \n",
       "  93.0547,132.342 93.1597,133.145 93.2647,133.951 93.3698,134.762 93.4748,135.576 93.5798,136.394 93.6848,137.215 93.7898,138.04 93.8948,138.869 93.9998,139.702 \n",
       "  94.1048,140.538 94.2099,141.377 94.3149,142.22 94.4199,143.067 94.5249,143.916 94.6299,144.769 94.7349,145.626 94.8399,146.485 94.945,147.348 95.05,148.213 \n",
       "  95.155,149.082 95.26,149.953 95.365,150.828 95.47,151.705 95.575,152.584 95.68,153.466 95.7851,154.35 95.8901,155.237 95.9951,156.126 96.1001,157.017 \n",
       "  96.2051,157.91 96.3101,158.805 96.4151,159.702 96.5201,160.6 96.6252,161.5 96.7302,162.401 96.8352,163.303 96.9402,164.207 97.0452,165.111 97.1502,166.017 \n",
       "  97.2552,166.923 97.3603,167.83 97.4653,168.737 97.5703,169.645 97.6753,170.552 97.7803,171.46 97.8853,172.368 97.9903,173.275 98.0953,174.182 98.2004,175.089 \n",
       "  98.3054,175.995 98.4104,176.9 98.5154,177.805 98.6204,178.708 98.7254,179.611 98.8304,180.512 98.9354,181.411 99.0405,182.309 99.1455,183.206 99.2505,184.101 \n",
       "  99.3555,184.994 99.4605,185.885 99.5655,186.774 99.6705,187.66 99.7756,188.545 99.8806,189.427 99.9856,190.307 100.091,191.184 100.196,192.059 100.301,192.931 \n",
       "  100.406,193.8 100.511,194.667 100.616,195.53 100.721,196.391 100.826,197.248 100.931,198.103 101.036,198.954 101.141,199.802 101.246,200.647 101.351,201.489 \n",
       "  101.456,202.327 101.561,203.162 101.666,203.993 101.771,204.821 101.876,205.646 101.981,206.467 102.086,207.285 102.191,208.099 102.296,208.909 102.401,209.716 \n",
       "  102.506,210.52 102.611,211.32 102.716,212.116 102.821,212.908 102.926,213.697 103.031,214.482 103.136,215.264 103.241,216.042 103.346,216.817 103.451,217.587 \n",
       "  103.556,218.354 103.661,219.118 103.766,219.878 103.871,220.634 103.976,221.387 104.081,222.136 104.186,222.881 104.291,223.623 104.396,224.362 104.501,225.096 \n",
       "  104.606,225.828 104.711,226.555 104.816,227.28 104.921,228 105.026,228.718 105.131,229.431 105.236,230.142 105.341,230.849 105.446,231.552 105.551,232.252 \n",
       "  105.656,232.949 105.761,233.643 105.866,234.333 105.971,235.02 106.076,235.703 106.181,236.383 106.286,237.06 106.391,237.734 106.496,238.405 106.601,239.072 \n",
       "  106.706,239.736 106.811,240.397 106.916,241.055 107.021,241.71 107.126,242.361 107.231,243.01 107.336,243.656 107.441,244.298 107.547,244.938 107.652,245.574 \n",
       "  107.757,246.208 107.862,246.838 107.967,247.466 108.072,248.091 108.177,248.713 108.282,249.332 108.387,249.948 108.492,250.562 108.597,251.172 108.702,251.78 \n",
       "  108.807,252.385 108.912,252.987 109.017,253.587 109.122,254.183 109.227,254.778 109.332,255.369 109.437,255.958 109.542,256.544 109.647,257.127 109.752,257.708 \n",
       "  109.857,258.287 109.962,258.862 110.067,259.435 110.172,260.006 110.277,260.574 110.382,261.14 110.487,261.703 110.592,262.263 110.697,262.822 110.802,263.377 \n",
       "  110.907,263.931 111.012,264.482 111.117,265.03 111.222,265.576 111.327,266.12 111.432,266.661 111.537,267.2 111.642,267.737 111.747,268.272 111.852,268.804 \n",
       "  111.957,269.334 112.062,269.861 112.167,270.386 112.272,270.91 112.377,271.43 112.482,271.949 112.587,272.465 112.692,272.98 112.797,273.492 112.902,274.002 \n",
       "  113.007,274.509 113.112,275.015 113.217,275.518 113.322,276.02 113.427,276.519 113.532,277.016 113.637,277.511 113.742,278.004 113.847,278.495 113.952,278.984 \n",
       "  114.057,279.471 114.162,279.955 114.267,280.438 114.372,280.919 114.477,281.398 114.582,281.874 114.687,282.349 114.792,282.822 114.897,283.293 115.002,283.762 \n",
       "  115.107,284.228 115.212,284.693 115.317,285.156 115.422,285.618 115.527,286.077 115.633,286.534 115.738,286.989 115.843,287.443 115.948,287.894 116.053,288.344 \n",
       "  116.158,288.792 116.263,289.238 116.368,289.682 116.473,290.125 116.578,290.565 116.683,291.004 116.788,291.441 116.893,291.876 116.998,292.309 117.103,292.74 \n",
       "  117.208,293.17 117.313,293.597 117.418,294.024 117.523,294.448 117.628,294.87 117.733,295.291 117.838,295.71 117.943,296.127 118.048,296.542 118.153,296.956 \n",
       "  118.258,297.368 118.363,297.778 118.468,298.187 118.573,298.594 118.678,298.999 118.783,299.402 118.888,299.804 118.993,300.204 119.098,300.602 119.203,300.998 \n",
       "  119.308,301.393 119.413,301.787 119.518,302.178 119.623,302.568 119.728,302.956 119.833,303.343 119.938,303.727 120.043,304.111 120.148,304.492 120.253,304.872 \n",
       "  120.358,305.25 120.463,305.627 120.568,306.002 120.673,306.375 120.778,306.747 120.883,307.117 120.988,307.485 121.093,307.852 121.198,308.217 121.303,308.581 \n",
       "  121.408,308.943 121.513,309.303 121.618,309.662 121.723,310.019 121.828,310.375 121.933,310.729 122.038,311.081 122.143,311.432 122.248,311.781 122.353,312.129 \n",
       "  122.458,312.475 122.563,312.819 122.668,313.162 122.773,313.503 122.878,313.843 122.983,314.181 123.088,314.518 123.193,314.853 123.298,315.186 123.403,315.518 \n",
       "  123.508,315.848 123.613,316.177 123.719,316.504 123.824,316.83 123.929,317.154 124.034,317.476 124.139,317.797 124.244,318.117 124.349,318.435 124.454,318.751 \n",
       "  124.559,319.066 124.664,319.379 124.769,319.691 124.874,320.001 124.979,320.309 125.084,320.617 125.189,320.922 125.294,321.226 125.399,321.529 125.504,321.83 \n",
       "  125.609,322.129 125.714,322.427 125.819,322.723 125.924,323.018 126.029,323.311 126.134,323.603 126.239,323.893 126.344,324.182 126.449,324.469 126.554,324.755 \n",
       "  126.659,325.039 126.764,325.322 126.869,325.603 126.974,325.882 127.079,326.16 127.184,326.437 127.289,326.712 127.394,326.985 127.499,327.257 127.604,327.528 \n",
       "  127.709,327.797 127.814,328.064 127.919,328.33 128.024,328.594 128.129,328.857 128.234,329.118 128.339,329.378 128.444,329.637 128.549,329.893 128.654,330.149 \n",
       "  128.759,330.402 128.864,330.655 128.969,330.905 129.074,331.154 129.179,331.402 129.284,331.648 129.389,331.893 129.494,332.136 129.599,332.378 129.704,332.618 \n",
       "  129.809,332.856 129.914,333.093 130.019,333.329 130.124,333.563 130.229,333.796 130.334,334.026 130.439,334.256 130.544,334.484 130.649,334.71 130.754,334.935 \n",
       "  130.859,335.159 130.964,335.381 131.069,335.601 131.174,335.82 131.279,336.037 131.384,336.253 131.489,336.467 131.594,336.68 131.699,336.891 131.805,337.101 \n",
       "  131.91,337.309 132.015,337.516 132.12,337.721 132.225,337.924 132.33,338.126 132.435,338.327 132.54,338.526 132.645,338.723 132.75,338.919 132.855,339.114 \n",
       "  132.96,339.307 133.065,339.498 133.17,339.688 133.275,339.876 133.38,340.063 133.485,340.248 133.59,340.432 133.695,340.614 133.8,340.795 133.905,340.974 \n",
       "  134.01,341.152 134.115,341.328 134.22,341.502 134.325,341.675 134.43,341.846 134.535,342.016 134.64,342.185 134.745,342.351 134.85,342.517 134.955,342.68 \n",
       "  135.06,342.842 135.165,343.003 135.27,343.162 135.375,343.32 135.48,343.476 135.585,343.63 135.69,343.783 135.795,343.934 135.9,344.084 136.005,344.232 \n",
       "  136.11,344.379 136.215,344.524 136.32,344.667 136.425,344.809 136.53,344.95 136.635,345.088 136.74,345.226 136.845,345.361 136.95,345.496 137.055,345.628 \n",
       "  137.16,345.759 137.265,345.889 137.37,346.017 137.475,346.143 137.58,346.268 137.685,346.391 137.79,346.513 137.895,346.633 138,346.751 138.105,346.868 \n",
       "  138.21,346.983 138.315,347.097 138.42,347.209 138.525,347.32 138.63,347.429 138.735,347.536 138.84,347.642 138.945,347.747 139.05,347.849 139.155,347.95 \n",
       "  139.26,348.05 139.365,348.148 139.47,348.244 139.575,348.339 139.68,348.432 139.785,348.524 139.891,348.614 139.996,348.702 140.101,348.789 140.206,348.874 \n",
       "  140.311,348.958 140.416,349.04 140.521,349.12 140.626,349.199 140.731,349.276 140.836,349.352 140.941,349.426 141.046,349.498 141.151,349.569 141.256,349.638 \n",
       "  141.361,349.706 141.466,349.771 141.571,349.836 141.676,349.899 141.781,349.96 141.886,350.019 141.991,350.077 142.096,350.133 142.201,350.188 142.306,350.241 \n",
       "  142.411,350.293 142.516,350.342 142.621,350.39 142.726,350.437 142.831,350.482 142.936,350.525 143.041,350.567 143.146,350.607 143.251,350.645 143.356,350.682 \n",
       "  143.461,350.717 143.566,350.751 143.671,350.783 143.776,350.813 143.881,350.842 143.986,350.869 144.091,350.894 144.196,350.918 144.301,350.94 144.406,350.96 \n",
       "  144.511,350.979 144.616,350.996 144.721,351.012 144.826,351.025 144.931,351.038 145.036,351.048 145.141,351.057 145.246,351.064 145.351,351.07 145.456,351.074 \n",
       "  145.561,351.076 145.666,351.077 145.771,351.075 145.876,351.073 145.981,351.068 146.086,351.062 146.191,351.055 146.296,351.045 146.401,351.034 146.506,351.022 \n",
       "  146.611,351.007 146.716,350.991 146.821,350.973 146.926,350.954 147.031,350.933 147.136,350.91 147.241,350.886 147.346,350.86 147.451,350.832 147.556,350.802 \n",
       "  147.661,350.771 147.766,350.739 147.871,350.704 147.977,350.668 148.082,350.63 148.187,350.59 148.292,350.549 148.397,350.506 148.502,350.462 148.607,350.415 \n",
       "  148.712,350.367 148.817,350.317 148.922,350.266 149.027,350.213 149.132,350.158 149.237,350.101 149.342,350.043 149.447,349.983 149.552,349.922 149.657,349.858 \n",
       "  149.762,349.793 149.867,349.726 149.972,349.658 150.077,349.588 150.182,349.516 150.287,349.442 150.392,349.367 150.497,349.289 150.602,349.211 150.707,349.13 \n",
       "  150.812,349.048 150.917,348.964 151.022,348.878 151.127,348.791 151.232,348.701 151.337,348.61 151.442,348.518 151.547,348.423 151.652,348.327 151.757,348.229 \n",
       "  151.862,348.13 151.967,348.028 152.072,347.925 152.177,347.82 152.282,347.713 152.387,347.605 152.492,347.495 152.597,347.383 152.702,347.269 152.807,347.154 \n",
       "  152.912,347.037 153.017,346.918 153.122,346.797 153.227,346.675 153.332,346.55 153.437,346.424 153.542,346.296 153.647,346.167 153.752,346.035 153.857,345.902 \n",
       "  153.962,345.767 154.067,345.631 154.172,345.492 154.277,345.352 154.382,345.21 154.487,345.066 154.592,344.92 154.697,344.773 154.802,344.623 154.907,344.472 \n",
       "  155.012,344.319 155.117,344.165 155.222,344.008 155.327,343.85 155.432,343.69 155.537,343.528 155.642,343.364 155.747,343.198 155.852,343.031 155.957,342.862 \n",
       "  156.063,342.691 156.168,342.518 156.273,342.343 156.378,342.166 156.483,341.988 156.588,341.807 156.693,341.625 156.798,341.441 156.903,341.255 157.008,341.068 \n",
       "  157.113,340.878 157.218,340.687 157.323,340.493 157.428,340.298 157.533,340.101 157.638,339.902 157.743,339.701 157.848,339.499 157.953,339.294 158.058,339.088 \n",
       "  158.163,338.879 158.268,338.669 158.373,338.457 158.478,338.243 158.583,338.027 158.688,337.809 158.793,337.589 158.898,337.367 159.003,337.143 159.108,336.918 \n",
       "  159.213,336.69 159.318,336.461 159.423,336.23 159.528,335.996 159.633,335.761 159.738,335.524 159.843,335.284 159.948,335.043 160.053,334.8 160.158,334.555 \n",
       "  160.263,334.308 160.368,334.059 160.473,333.808 160.578,333.555 160.683,333.3 160.788,333.043 160.893,332.784 160.998,332.523 161.103,332.26 161.208,331.995 \n",
       "  161.313,331.728 161.418,331.458 161.523,331.187 161.628,330.914 161.733,330.639 161.838,330.362 161.943,330.082 162.048,329.801 162.153,329.517 162.258,329.232 \n",
       "  162.363,328.944 162.468,328.654 162.573,328.363 162.678,328.069 162.783,327.773 162.888,327.475 162.993,327.174 163.098,326.872 163.203,326.568 163.308,326.261 \n",
       "  163.413,325.952 163.518,325.641 163.623,325.328 163.728,325.013 163.833,324.696 163.938,324.376 164.043,324.054 164.149,323.73 164.254,323.404 164.359,323.076 \n",
       "  164.464,322.745 164.569,322.412 164.674,322.077 164.779,321.74 164.884,321.4 164.989,321.058 165.094,320.714 165.199,320.368 165.304,320.019 165.409,319.668 \n",
       "  165.514,319.315 165.619,318.96 165.724,318.602 165.829,318.242 165.934,317.879 166.039,317.514 166.144,317.147 166.249,316.777 166.354,316.405 166.459,316.031 \n",
       "  166.564,315.654 166.669,315.275 166.774,314.893 166.879,314.509 166.984,314.123 167.089,313.734 167.194,313.342 167.299,312.948 167.404,312.552 167.509,312.153 \n",
       "  167.614,311.752 167.719,311.348 167.824,310.941 167.929,310.532 168.034,310.121 168.139,309.707 168.244,309.29 168.349,308.871 168.454,308.449 168.559,308.024 \n",
       "  168.664,307.597 168.769,307.167 168.874,306.735 168.979,306.3 169.084,305.862 169.189,305.421 169.294,304.978 169.399,304.532 169.504,304.083 169.609,303.631 \n",
       "  169.714,303.177 169.819,302.72 169.924,302.26 170.029,301.797 170.134,301.332 170.239,300.863 170.344,300.392 170.449,299.917 170.554,299.44 170.659,298.96 \n",
       "  170.764,298.477 170.869,297.991 170.974,297.502 171.079,297.01 171.184,296.515 171.289,296.017 171.394,295.516 171.499,295.012 171.604,294.504 171.709,293.994 \n",
       "  171.814,293.48 171.919,292.964 172.024,292.444 172.129,291.921 172.235,291.395 172.34,290.865 172.445,290.333 172.55,289.797 172.655,289.257 172.76,288.715 \n",
       "  172.865,288.169 172.97,287.62 173.075,287.067 173.18,286.511 173.285,285.951 173.39,285.389 173.495,284.822 173.6,284.252 173.705,283.679 173.81,283.102 \n",
       "  173.915,282.522 174.02,281.938 174.125,281.35 174.23,280.759 174.335,280.164 174.44,279.566 174.545,278.964 174.65,278.358 174.755,277.749 174.86,277.135 \n",
       "  174.965,276.518 175.07,275.897 175.175,275.273 175.28,274.644 175.385,274.012 175.49,273.376 175.595,272.736 175.7,272.092 175.805,271.444 175.91,270.792 \n",
       "  176.015,270.137 176.12,269.477 176.225,268.813 176.33,268.145 176.435,267.473 176.54,266.798 176.645,266.118 176.75,265.434 176.855,264.746 176.96,264.054 \n",
       "  177.065,263.357 177.17,262.657 177.275,261.953 177.38,261.244 177.485,260.531 177.59,259.814 177.695,259.093 177.8,258.368 177.905,257.639 178.01,256.905 \n",
       "  178.115,256.168 178.22,255.426 178.325,254.68 178.43,253.93 178.535,253.176 178.64,252.418 178.745,251.656 178.85,250.89 178.955,250.119 179.06,249.345 \n",
       "  179.165,248.567 179.27,247.784 179.375,246.998 179.48,246.208 179.585,245.414 179.69,244.617 179.795,243.815 179.9,243.01 180.005,242.201 180.11,241.389 \n",
       "  180.215,240.573 180.321,239.754 180.426,238.931 180.531,238.105 180.636,237.276 180.741,236.444 180.846,235.608 180.951,234.769 181.056,233.928 181.161,233.084 \n",
       "  181.266,232.237 181.371,231.387 181.476,230.535 181.581,229.681 181.686,228.824 181.791,227.965 181.896,227.104 182.001,226.241 182.106,225.377 182.211,224.51 \n",
       "  182.316,223.643 182.421,222.773 182.526,221.903 182.631,221.031 182.736,220.158 182.841,219.285 182.946,218.411 183.051,217.536 183.156,216.66 183.261,215.785 \n",
       "  183.366,214.909 183.471,214.033 183.576,213.158 183.681,212.283 183.786,211.408 183.891,210.533 183.996,209.66 184.101,208.787 184.206,207.915 184.311,207.044 \n",
       "  184.416,206.174 184.521,205.306 184.626,204.439 184.731,203.574 184.836,202.711 184.941,201.849 185.046,200.989 185.151,200.131 185.256,199.276 185.361,198.423 \n",
       "  185.466,197.572 185.571,196.723 185.676,195.877 185.781,195.034 185.886,194.193 185.991,193.355 186.096,192.52 186.201,191.687 186.306,190.858 186.411,190.032 \n",
       "  186.516,189.209 186.621,188.389 186.726,187.572 186.831,186.758 186.936,185.948 187.041,185.141 187.146,184.338 187.251,183.538 187.356,182.741 187.461,181.948 \n",
       "  187.566,181.158 187.671,180.372 187.776,179.589 187.881,178.81 187.986,178.035 188.091,177.263 188.196,176.495 188.301,175.73 188.407,174.969 188.512,174.212 \n",
       "  188.617,173.458 188.722,172.708 188.827,171.961 188.932,171.219 189.037,170.479 189.142,169.744 189.247,169.012 189.352,168.284 189.457,167.559 189.562,166.838 \n",
       "  189.667,166.12 189.772,165.406 189.877,164.696 189.982,163.989 190.087,163.286 190.192,162.586 190.297,161.89 190.402,161.197 190.507,160.508 190.612,159.822 \n",
       "  190.717,159.14 190.822,158.461 190.927,157.785 191.032,157.113 191.137,156.444 191.242,155.779 191.347,155.117 191.452,154.458 191.557,153.802 191.662,153.15 \n",
       "  191.767,152.501 191.872,151.855 191.977,151.212 192.082,150.573 192.187,149.937 192.292,149.304 192.397,148.674 192.502,148.047 192.607,147.423 192.712,146.802 \n",
       "  192.817,146.184 192.922,145.569 193.027,144.958 193.132,144.349 193.237,143.743 193.342,143.14 193.447,142.54 193.552,141.943 193.657,141.348 193.762,140.757 \n",
       "  193.867,140.168 193.972,139.582 194.077,138.999 194.182,138.419 194.287,137.841 194.392,137.267 194.497,136.694 194.602,136.125 194.707,135.558 194.812,134.994 \n",
       "  194.917,134.432 195.022,133.873 195.127,133.317 195.232,132.763 195.337,132.212 195.442,131.663 195.547,131.117 195.652,130.573 195.757,130.032 195.862,129.493 \n",
       "  195.967,128.957 196.072,128.423 196.177,127.892 196.282,127.362 196.387,126.836 196.493,126.311 196.598,125.789 196.703,125.27 196.808,124.752 196.913,124.237 \n",
       "  197.018,123.724 197.123,123.214 197.228,122.705 197.333,122.199 197.438,121.695 197.543,121.194 197.648,120.694 197.753,120.197 197.858,119.702 197.963,119.209 \n",
       "  198.068,118.718 198.173,118.229 198.278,117.743 198.383,117.258 198.488,116.776 198.593,116.296 198.698,115.817 198.803,115.341 198.908,114.867 199.013,114.395 \n",
       "  199.118,113.925 199.223,113.456 199.328,112.99 199.433,112.526 199.538,112.064 199.643,111.603 199.748,111.145 199.853,110.689 199.958,110.234 200.063,109.782 \n",
       "  200.168,109.331 200.273,108.882 200.378,108.435 200.483,107.99 200.588,107.547 200.693,107.106 200.798,106.666 200.903,106.229 201.008,105.793 201.113,105.359 \n",
       "  201.218,104.927 201.323,104.496 201.428,104.068 201.533,103.641 201.638,103.216 201.743,102.792 201.848,102.371 201.953,101.951 202.058,101.533 202.163,101.117 \n",
       "  202.268,100.702 202.373,100.289 202.478,99.8779 202.583,99.4684 202.688,99.0606 202.793,98.6545 202.898,98.2501 203.003,97.8473 203.108,97.4462 203.213,97.0467 \n",
       "  203.318,96.6489 203.423,96.2527 203.528,95.8582 203.633,95.4653 203.738,95.074 203.843,94.6844 203.948,94.2963 204.053,93.9099 204.158,93.525 204.263,93.1418 \n",
       "  204.368,92.7601 204.473,92.3801 204.579,92.0016 204.684,91.6246 204.789,91.2493 204.894,90.8754 204.999,90.5032 205.104,90.1325 205.209,89.7633 205.314,89.3957 \n",
       "  205.419,89.0296 205.524,88.6651 205.629,88.302 205.734,87.9405 205.839,87.5805 205.944,87.222 206.049,86.8651 206.154,86.5096 206.259,86.1556 206.364,85.8031 \n",
       "  206.469,85.4521 206.574,85.1026 206.679,84.7546 206.784,84.408 206.889,84.063 206.994,83.7194 207.099,83.3772 207.204,83.0365 207.309,82.6973 207.414,82.3596 \n",
       "  207.519,82.0232 207.624,81.6884 207.729,81.355 207.834,81.023 207.939,80.6924 208.044,80.3633 208.149,80.0357 208.254,79.7094 208.359,79.3846 208.464,79.0612 \n",
       "  208.569,78.7392 208.674,78.4186 208.779,78.0995 208.884,77.7818 208.989,77.4654 209.094,77.1505 209.199,76.837 209.304,76.5249 209.409,76.2142 209.514,75.9048 \n",
       "  209.619,75.5969 209.724,75.2904 209.829,74.9852 209.934,74.6815 210.039,74.3791 210.144,74.0781 210.249,73.7785 210.354,73.4802 210.459,73.1834 210.564,72.8879 \n",
       "  210.669,72.5938 210.774,72.301 210.879,72.0096 210.984,71.7196 211.089,71.431 211.194,71.1437 211.299,70.8578 211.404,70.5732 211.509,70.29 211.614,70.0082 \n",
       "  211.719,69.7277 211.824,69.4486 211.929,69.1708 212.034,68.8944 212.139,68.6193 212.244,68.3456 212.349,68.0732 212.454,67.8022 212.559,67.5325 212.665,67.2641 \n",
       "  212.77,66.9971 212.875,66.7315 212.98,66.4671 213.085,66.2042 213.19,65.9425 213.295,65.6822 213.4,65.4232 213.505,65.1656 213.61,64.9093 213.715,64.6544 \n",
       "  213.82,64.4007 213.925,64.1484 214.03,63.8975 214.135,63.6478 214.24,63.3995 214.345,63.1526 214.45,62.9069 214.555,62.6626 214.66,62.4196 214.765,62.178 \n",
       "  214.87,61.9376 214.975,61.6986 215.08,61.461 215.185,61.2246 215.29,60.9896 215.395,60.7559 215.5,60.5235 215.605,60.2925 215.71,60.0627 215.815,59.8343 \n",
       "  215.92,59.6072 216.025,59.3815 216.13,59.1571 216.235,58.9339 216.34,58.7122 216.445,58.4917 216.55,58.2725 216.655,58.0547 216.76,57.8382 216.865,57.6231 \n",
       "  216.97,57.4092 217.075,57.1967 217.18,56.9855 217.285,56.7756 217.39,56.567 217.495,56.3598 217.6,56.1539 217.705,55.9493 217.81,55.746 217.915,55.5441 \n",
       "  218.02,55.3434 218.125,55.1441 218.23,54.9461 218.335,54.7495 218.44,54.5542 218.545,54.3602 218.65,54.1675 218.755,53.9761 218.86,53.7861 218.965,53.5974 \n",
       "  219.07,53.41 219.175,53.224 219.28,53.0392 219.385,52.8558 219.49,52.6738 219.595,52.493 219.7,52.3136 219.805,52.1355 219.91,51.9588 220.015,51.7833 \n",
       "  220.12,51.6092 220.225,51.4365 220.33,51.265 220.435,51.0949 220.54,50.9262 220.645,50.7587 220.751,50.5926 220.856,50.4278 220.961,50.2644 221.066,50.1023 \n",
       "  221.171,49.9415 221.276,49.7821 221.381,49.624 221.486,49.4673 221.591,49.3118 221.696,49.1578 221.801,49.005 221.906,48.8536 222.011,48.7036 222.116,48.5549 \n",
       "  222.221,48.4075 222.326,48.2614 222.431,48.1168 222.536,47.9734 222.641,47.8314 222.746,47.6908 222.851,47.5515 222.956,47.4135 223.061,47.2769 223.166,47.1416 \n",
       "  223.271,47.0077 223.376,46.8752 223.481,46.744 223.586,46.6141 223.691,46.4856 223.796,46.3585 223.901,46.2327 224.006,46.1082 224.111,45.9851 224.216,45.8634 \n",
       "  224.321,45.7431 224.426,45.6241 224.531,45.5064 224.636,45.3901 224.741,45.2752 224.846,45.1616 224.951,45.0494 225.056,44.9386 225.161,44.8291 225.266,44.721 \n",
       "  225.371,44.6143 225.476,44.5089 225.581,44.4049 225.686,44.3023 225.791,44.2011 225.896,44.1012 226.001,44.0027 226.106,43.9055 226.211,43.8098 226.316,43.7154 \n",
       "  226.421,43.6224 226.526,43.5307 226.631,43.4405 226.736,43.3516 226.841,43.2641 226.946,43.178 227.051,43.0933 227.156,43.0099 227.261,42.928 227.366,42.8474 \n",
       "  227.471,42.7682 227.576,42.6904 227.681,42.614 227.786,42.539 227.891,42.4654 227.996,42.3931 228.101,42.3223 228.206,42.2528 228.311,42.1848 228.416,42.1181 \n",
       "  228.521,42.0528 228.626,41.989 228.731,41.9265 228.837,41.8654 228.942,41.8058 229.047,41.7475 229.152,41.6906 229.257,41.6352 229.362,41.5811 229.467,41.5285 \n",
       "  229.572,41.4773 229.677,41.4274 229.782,41.379 229.887,41.332 229.992,41.2864 230.097,41.2422 230.202,41.1994 230.307,41.1581 230.412,41.1181 230.517,41.0796 \n",
       "  230.622,41.0425 230.727,41.0068 230.832,40.9726 230.937,40.9397 231.042,40.9083 231.147,40.8783 231.252,40.8497 231.357,40.8226 231.462,40.7969 231.567,40.7726 \n",
       "  231.672,40.7497 231.777,40.7283 231.882,40.7083 231.987,40.6897 232.092,40.6726 232.197,40.6569 232.302,40.6426 232.407,40.6298 232.512,40.6184 232.617,40.6085 \n",
       "  232.722,40.6 232.827,40.5929 232.932,40.5873 233.037,40.5831 233.142,40.5804 233.247,40.5791 233.352,40.5793 233.457,40.5809 233.562,40.5839 233.667,40.5885 \n",
       "  233.772,40.5944 233.877,40.6018 233.982,40.6107 234.087,40.621 234.192,40.6328 234.297,40.6461 234.402,40.6608 234.507,40.6769 234.612,40.6945 234.717,40.7136 \n",
       "  234.822,40.7342 234.927,40.7562 235.032,40.7797 235.137,40.8046 235.242,40.831 235.347,40.8589 235.452,40.8883 235.557,40.9191 235.662,40.9514 235.767,40.9852 \n",
       "  235.872,41.0205 235.977,41.0572 236.082,41.0954 236.187,41.1351 236.292,41.1763 236.397,41.219 236.502,41.2631 236.607,41.3087 236.712,41.3558 236.817,41.4044 \n",
       "  236.923,41.4545 237.028,41.5061 237.133,41.5592 237.238,41.6138 237.343,41.6698 237.448,41.7274 237.553,41.7864 237.658,41.847 237.763,41.9091 237.868,41.9726 \n",
       "  237.973,42.0377 238.078,42.1042 238.183,42.1723 238.288,42.2419 238.393,42.313 238.498,42.3856 238.603,42.4597 238.708,42.5353 238.813,42.6124 238.918,42.6911 \n",
       "  239.023,42.7712 239.128,42.8529 239.233,42.9361 239.338,43.0208 239.443,43.1071 239.548,43.1949 239.653,43.2842 239.758,43.375 239.863,43.4673 239.968,43.5612 \n",
       "  240.073,43.6566 240.178,43.7536 240.283,43.8521 240.388,43.9521 240.493,44.0537 240.598,44.1568 240.703,44.2614 240.808,44.3676 240.913,44.4754 241.018,44.5847 \n",
       "  241.123,44.6955 241.228,44.8079 241.333,44.9218 241.438,45.0373 241.543,45.1544 241.648,45.273 241.753,45.3931 241.858,45.5149 241.963,45.6382 242.068,45.763 \n",
       "  242.173,45.8894 242.278,46.0174 242.383,46.147 242.488,46.2781 242.593,46.4109 242.698,46.5451 242.803,46.681 242.908,46.8185 243.013,46.9575 243.118,47.0981 \n",
       "  243.223,47.2403 243.328,47.3841 243.433,47.5295 243.538,47.6765 243.643,47.8251 243.748,47.9752 243.853,48.127 243.958,48.2804 244.063,48.4354 244.168,48.592 \n",
       "  244.273,48.7502 244.378,48.91 244.483,49.0714 244.588,49.2345 244.693,49.3991 244.798,49.5654 244.903,49.7333 245.009,49.9028 245.114,50.074 245.219,50.2468 \n",
       "  245.324,50.4212 245.429,50.5973 245.534,50.775 245.639,50.9543 245.744,51.1353 245.849,51.318 245.954,51.5023 246.059,51.6882 246.164,51.8758 246.269,52.065 \n",
       "  246.374,52.256 246.479,52.4485 246.584,52.6428 246.689,52.8387 246.794,53.0363 246.899,53.2356 247.004,53.4365 247.109,53.6392 247.214,53.8435 247.319,54.0495 \n",
       "  247.424,54.2572 247.529,54.4666 247.634,54.6777 247.739,54.8905 247.844,55.105 247.949,55.3213 248.054,55.5392 248.159,55.7588 248.264,55.9802 248.369,56.2033 \n",
       "  248.474,56.4281 248.579,56.6547 248.684,56.883 248.789,57.113 248.894,57.3448 248.999,57.5783 249.104,57.8136 249.209,58.0506 249.314,58.2894 249.419,58.53 \n",
       "  249.524,58.7723 249.629,59.0164 249.734,59.2623 249.839,59.5099 249.944,59.7594 250.049,60.0106 250.154,60.2636 250.259,60.5184 250.364,60.7751 250.469,61.0335 \n",
       "  250.574,61.2938 250.679,61.5558 250.784,61.8197 250.889,62.0855 250.994,62.353 251.099,62.6224 251.204,62.8937 251.309,63.1667 251.414,63.4417 251.519,63.7185 \n",
       "  251.624,63.9972 251.729,64.2777 251.834,64.5601 251.939,64.8444 252.044,65.1306 252.149,65.4187 252.254,65.7087 252.359,66.0006 252.464,66.2944 252.569,66.5901 \n",
       "  252.674,66.8877 252.779,67.1873 252.884,67.4888 252.989,67.7923 253.095,68.0977 253.2,68.4051 253.305,68.7144 253.41,69.0257 253.515,69.339 253.62,69.6543 \n",
       "  253.725,69.9715 253.83,70.2908 253.935,70.6121 254.04,70.9353 254.145,71.2606 254.25,71.588 254.355,71.9173 254.46,72.2488 254.565,72.5822 254.67,72.9178 \n",
       "  254.775,73.2554 254.88,73.5951 254.985,73.9368 255.09,74.2807 255.195,74.6267 255.3,74.9747 255.405,75.3249 255.51,75.6773 255.615,76.0317 255.72,76.3884 \n",
       "  255.825,76.7471 255.93,77.1081 256.035,77.4712 256.14,77.8365 256.245,78.204 256.35,78.5737 256.455,78.9457 256.56,79.3198 256.665,79.6962 256.77,80.0749 \n",
       "  256.875,80.4558 256.98,80.839 257.085,81.2244 257.19,81.6122 257.295,82.0023 257.4,82.3946 257.505,82.7893 257.61,83.1864 257.715,83.5858 257.82,83.9875 \n",
       "  257.925,84.3916 258.03,84.7982 258.135,85.2071 258.24,85.6184 258.345,86.0322 258.45,86.4484 258.555,86.867 258.66,87.2881 258.765,87.7117 258.87,88.1378 \n",
       "  258.975,88.5664 259.08,88.9975 259.185,89.4312 259.29,89.8674 259.395,90.3062 259.5,90.7475 259.605,91.1915 259.71,91.638 259.815,92.0872 259.92,92.539 \n",
       "  260.025,92.9935 260.13,93.4507 260.235,93.9105 260.34,94.3731 260.445,94.8384 260.55,95.3064 260.655,95.7772 260.76,96.2507 260.865,96.7271 260.97,97.2063 \n",
       "  261.075,97.6883 261.181,98.1731 261.286,98.6608 261.391,99.1514 261.496,99.6449 261.601,100.141 261.706,100.641 261.811,101.143 261.916,101.648 262.021,102.157 \n",
       "  262.126,102.668 262.231,103.182 262.336,103.7 262.441,104.22 262.546,104.744 262.651,105.27 262.756,105.8 262.861,106.333 262.966,106.87 263.071,107.409 \n",
       "  263.176,107.952 263.281,108.498 263.386,109.047 263.491,109.599 263.596,110.155 263.701,110.714 263.806,111.277 263.911,111.843 264.016,112.412 264.121,112.985 \n",
       "  264.226,113.561 264.331,114.141 264.436,114.724 264.541,115.311 264.646,115.901 264.751,116.495 264.856,117.092 264.961,117.694 265.066,118.298 265.171,118.907 \n",
       "  265.276,119.519 265.381,120.135 265.486,120.754 265.591,121.378 265.696,122.005 265.801,122.636 265.906,123.271 266.011,123.909 266.116,124.552 266.221,125.198 \n",
       "  266.326,125.849 266.431,126.503 266.536,127.161 266.641,127.824 266.746,128.49 266.851,129.16 266.956,129.834 267.061,130.513 267.166,131.195 267.271,131.882 \n",
       "  267.376,132.572 267.481,133.267 267.586,133.966 267.691,134.669 267.796,135.376 267.901,136.088 268.006,136.803 268.111,137.523 268.216,138.247 268.321,138.975 \n",
       "  268.426,139.707 268.531,140.443 268.636,141.184 268.741,141.928 268.846,142.677 268.951,143.43 269.056,144.188 269.161,144.949 269.267,145.714 269.372,146.484 \n",
       "  269.477,147.257 269.582,148.035 269.687,148.817 269.792,149.602 269.897,150.392 270.002,151.185 270.107,151.982 270.212,152.784 270.317,153.588 270.422,154.397 \n",
       "  270.527,155.209 270.632,156.025 270.737,156.845 270.842,157.667 270.947,158.494 271.052,159.323 271.157,160.156 271.262,160.992 271.367,161.831 271.472,162.673 \n",
       "  271.577,163.517 271.682,164.365 271.787,165.215 271.892,166.068 271.997,166.923 272.102,167.78 272.207,168.64 272.312,169.501 272.417,170.365 272.522,171.23 \n",
       "  272.627,172.097 272.732,172.965 272.837,173.835 272.942,174.706 273.047,175.578 273.152,176.451 273.257,177.325 273.362,178.199 273.467,179.074 273.572,179.949 \n",
       "  273.677,180.824 273.782,181.699 273.887,182.574 273.992,183.449 274.097,184.323 274.202,185.197 274.307,186.07 274.412,186.942 274.517,187.813 274.622,188.682 \n",
       "  274.727,189.551 274.832,190.417 274.937,191.282 275.042,192.146 275.147,193.007 275.252,193.867 275.357,194.724 275.462,195.579 275.567,196.431 275.672,197.281 \n",
       "  275.777,198.129 275.882,198.973 275.987,199.815 276.092,200.654 276.197,201.49 276.302,202.323 276.407,203.153 276.512,203.979 276.617,204.802 276.722,205.622 \n",
       "  276.827,206.438 276.932,207.251 277.037,208.06 277.142,208.865 277.247,209.667 277.353,210.465 277.458,211.259 277.563,212.049 277.668,212.836 277.773,213.619 \n",
       "  277.878,214.397 277.983,215.172 278.088,215.943 278.193,216.71 278.298,217.472 278.403,218.231 278.508,218.986 278.613,219.736 278.718,220.483 278.823,221.225 \n",
       "  278.928,221.964 279.033,222.698 279.138,223.429 279.243,224.155 279.348,224.877 279.453,225.595 279.558,226.309 279.663,227.019 279.768,227.725 279.873,228.427 \n",
       "  279.978,229.125 280.083,229.819 280.188,230.509 280.293,231.195 280.398,231.878 280.503,232.556 280.608,233.23 280.713,233.9 280.818,234.567 280.923,235.229 \n",
       "  281.028,235.888 281.133,236.543 281.238,237.194 281.343,237.842 281.448,238.485 281.553,239.125 281.658,239.761 281.763,240.394 281.868,241.023 281.973,241.648 \n",
       "  282.078,242.27 282.183,242.888 282.288,243.502 282.393,244.113 282.498,244.72 282.603,245.324 282.708,245.925 282.813,246.522 282.918,247.115 283.023,247.705 \n",
       "  283.128,248.292 283.233,248.875 283.338,249.455 283.443,250.032 283.548,250.605 283.653,251.176 283.758,251.743 283.863,252.306 283.968,252.867 284.073,253.424 \n",
       "  284.178,253.978 284.283,254.529 284.388,255.077 284.493,255.622 284.598,256.164 284.703,256.703 284.808,257.239 284.913,257.771 285.018,258.301 285.123,258.828 \n",
       "  285.228,259.352 285.333,259.873 285.439,260.391 285.544,260.906 285.649,261.418 285.754,261.928 285.859,262.435 285.964,262.938 286.069,263.44 286.174,263.938 \n",
       "  286.279,264.433 286.384,264.926 286.489,265.417 286.594,265.904 286.699,266.389 286.804,266.871 286.909,267.35 287.014,267.827 287.119,268.302 287.224,268.773 \n",
       "  287.329,269.243 287.434,269.709 287.539,270.173 287.644,270.635 287.749,271.094 287.854,271.55 287.959,272.004 288.064,272.456 288.169,272.905 288.274,273.352 \n",
       "  288.379,273.796 288.484,274.238 288.589,274.678 288.694,275.115 288.799,275.55 288.904,275.982 289.009,276.412 289.114,276.84 289.219,277.266 289.324,277.689 \n",
       "  289.429,278.11 289.534,278.528 289.639,278.945 289.744,279.359 289.849,279.771 289.954,280.181 290.059,280.588 290.164,280.993 290.269,281.397 290.374,281.798 \n",
       "  290.479,282.196 290.584,282.593 290.689,282.987 290.794,283.38 290.899,283.77 291.004,284.158 291.109,284.544 291.214,284.928 291.319,285.31 291.424,285.69 \n",
       "  291.529,286.068 291.634,286.443 291.739,286.817 291.844,287.189 291.949,287.558 292.054,287.926 292.159,288.292 292.264,288.655 292.369,289.017 292.474,289.376 \n",
       "  292.579,289.734 292.684,290.09 292.789,290.444 292.894,290.795 292.999,291.145 293.104,291.493 293.209,291.839 293.314,292.184 293.419,292.526 293.525,292.866 \n",
       "  293.63,293.205 293.735,293.541 293.84,293.876 293.945,294.209 294.05,294.54 294.155,294.869 294.26,295.196 294.365,295.521 294.47,295.845 294.575,296.167 \n",
       "  294.68,296.487 294.785,296.805 294.89,297.121 294.995,297.436 295.1,297.749 295.205,298.059 295.31,298.369 295.415,298.676 295.52,298.982 295.625,299.286 \n",
       "  295.73,299.588 295.835,299.888 295.94,300.187 296.045,300.483 296.15,300.779 296.255,301.072 296.36,301.364 296.465,301.653 296.57,301.942 296.675,302.228 \n",
       "  296.78,302.513 296.885,302.796 296.99,303.078 297.095,303.357 297.2,303.635 297.305,303.912 297.41,304.186 297.515,304.459 297.62,304.731 297.725,305 \n",
       "  297.83,305.268 297.935,305.535 298.04,305.799 298.145,306.062 298.25,306.324 298.355,306.583 298.46,306.842 298.565,307.098 298.67,307.353 298.775,307.606 \n",
       "  298.88,307.858 298.985,308.108 299.09,308.356 299.195,308.603 299.3,308.848 299.405,309.092 299.51,309.333 299.615,309.574 299.72,309.813 299.825,310.05 \n",
       "  299.93,310.285 300.035,310.519 300.14,310.752 300.245,310.983 300.35,311.212 300.455,311.44 300.56,311.666 300.665,311.89 300.77,312.113 300.875,312.335 \n",
       "  300.98,312.555 301.085,312.773 301.19,312.99 301.295,313.205 301.4,313.419 301.505,313.631 301.611,313.842 301.716,314.051 301.821,314.258 301.926,314.465 \n",
       "  302.031,314.669 302.136,314.872 302.241,315.073 302.346,315.273 302.451,315.472 302.556,315.669 302.661,315.864 302.766,316.058 302.871,316.25 302.976,316.441 \n",
       "  303.081,316.631 303.186,316.818 303.291,317.005 303.396,317.19 303.501,317.373 303.606,317.555 303.711,317.735 303.816,317.914 303.921,318.091 304.026,318.267 \n",
       "  304.131,318.442 304.236,318.615 304.341,318.786 304.446,318.956 304.551,319.125 304.656,319.292 304.761,319.457 304.866,319.621 304.971,319.784 305.076,319.945 \n",
       "  305.181,320.105 305.286,320.263 305.391,320.42 305.496,320.575 305.601,320.729 305.706,320.881 305.811,321.032 305.916,321.181 306.021,321.329 306.126,321.476 \n",
       "  306.231,321.621 306.336,321.765 306.441,321.907 306.546,322.047 306.651,322.187 306.756,322.325 306.861,322.461 306.966,322.596 307.071,322.73 307.176,322.862 \n",
       "  307.281,322.992 307.386,323.121 307.491,323.249 307.596,323.376 307.701,323.5 307.806,323.624 307.911,323.746 308.016,323.867 308.121,323.986 308.226,324.104 \n",
       "  308.331,324.22 308.436,324.335 308.541,324.448 308.646,324.56 308.751,324.671 308.856,324.78 308.961,324.888 309.066,324.995 309.171,325.1 309.276,325.203 \n",
       "  309.381,325.305 309.486,325.406 309.591,325.505 309.697,325.603 309.802,325.7 309.907,325.795 310.012,325.889 310.117,325.981 310.222,326.072 310.327,326.161 \n",
       "  310.432,326.249 310.537,326.336 310.642,326.421 310.747,326.505 310.852,326.588 310.957,326.669 311.062,326.748 311.167,326.827 311.272,326.903 311.377,326.979 \n",
       "  311.482,327.053 311.587,327.126 311.692,327.197 311.797,327.267 311.902,327.335 312.007,327.403 312.112,327.468 312.217,327.533 312.322,327.596 312.427,327.657 \n",
       "  312.532,327.717 312.637,327.776 312.742,327.833 312.847,327.889 312.952,327.944 313.057,327.997 313.162,328.049 313.267,328.1 313.372,328.149 313.477,328.197 \n",
       "  313.582,328.243 313.687,328.288 313.792,328.332 313.897,328.374 314.002,328.415 314.107,328.454 314.212,328.492 314.317,328.529 314.422,328.564 314.527,328.598 \n",
       "  314.632,328.631 314.737,328.662 314.842,328.692 314.947,328.72 315.052,328.747 315.157,328.773 315.262,328.798 315.367,328.821 315.472,328.842 315.577,328.863 \n",
       "  315.682,328.881 315.787,328.899 315.892,328.915 315.997,328.93 316.102,328.943 316.207,328.956 316.312,328.966 316.417,328.976 316.522,328.984 316.627,328.99 \n",
       "  316.732,328.996 316.837,329 316.942,329.002 317.047,329.003 317.152,329.003 317.257,329.002 317.362,328.999 317.467,328.995 317.572,328.989 317.677,328.982 \n",
       "  317.783,328.974 317.888,328.964 317.993,328.953 318.098,328.941 318.203,328.927 318.308,328.912 318.413,328.896 318.518,328.878 318.623,328.859 318.728,328.839 \n",
       "  318.833,328.817 318.938,328.794 319.043,328.769 319.148,328.744 319.253,328.717 319.358,328.688 319.463,328.658 319.568,328.627 319.673,328.595 319.778,328.561 \n",
       "  319.883,328.525 319.988,328.489 320.093,328.451 320.198,328.412 320.303,328.371 320.408,328.329 320.513,328.286 320.618,328.241 320.723,328.196 320.828,328.148 \n",
       "  320.933,328.1 321.038,328.05 321.143,327.998 321.248,327.946 321.353,327.892 321.458,327.837 321.563,327.78 321.668,327.722 321.773,327.663 321.878,327.602 \n",
       "  321.983,327.54 322.088,327.477 322.193,327.412 322.298,327.346 322.403,327.279 322.508,327.21 322.613,327.141 322.718,327.069 322.823,326.997 322.928,326.923 \n",
       "  323.033,326.848 323.138,326.771 323.243,326.693 323.348,326.614 323.453,326.533 323.558,326.451 323.663,326.368 323.768,326.284 323.873,326.198 323.978,326.111 \n",
       "  324.083,326.022 324.188,325.932 324.293,325.841 324.398,325.749 324.503,325.655 324.608,325.56 324.713,325.463 324.818,325.365 324.923,325.266 325.028,325.166 \n",
       "  325.133,325.064 325.238,324.961 325.343,324.857 325.448,324.751 325.553,324.644 325.658,324.536 325.763,324.426 325.869,324.315 325.974,324.203 326.079,324.089 \n",
       "  326.184,323.974 326.289,323.858 326.394,323.741 326.499,323.622 326.604,323.501 326.709,323.38 326.814,323.257 326.919,323.133 327.024,323.008 327.129,322.881 \n",
       "  327.234,322.753 327.339,322.623 327.444,322.492 327.549,322.36 327.654,322.227 327.759,322.092 327.864,321.956 327.969,321.819 328.074,321.68 328.179,321.541 \n",
       "  328.284,321.399 328.389,321.257 328.494,321.113 328.599,320.968 328.704,320.821 328.809,320.673 328.914,320.524 329.019,320.374 329.124,320.222 329.229,320.069 \n",
       "  329.334,319.914 329.439,319.759 329.544,319.602 329.649,319.443 329.754,319.283 329.859,319.122 329.964,318.96 330.069,318.797 330.174,318.632 330.279,318.465 \n",
       "  330.384,318.298 330.489,318.129 330.594,317.959 330.699,317.787 330.804,317.614 330.909,317.44 331.014,317.265 331.119,317.088 331.224,316.91 331.329,316.73 \n",
       "  331.434,316.549 331.539,316.367 331.644,316.184 331.749,315.999 331.854,315.813 331.959,315.626 332.064,315.437 332.169,315.247 332.274,315.055 332.379,314.863 \n",
       "  332.484,314.669 332.589,314.473 332.694,314.277 332.799,314.079 332.904,313.879 333.009,313.679 333.114,313.477 333.219,313.274 333.324,313.069 333.429,312.863 \n",
       "  333.534,312.656 333.639,312.447 333.744,312.237 333.849,312.026 333.955,311.813 334.06,311.599 334.165,311.384 334.27,311.167 334.375,310.949 334.48,310.73 \n",
       "  334.585,310.509 334.69,310.287 334.795,310.064 334.9,309.839 335.005,309.613 335.11,309.385 335.215,309.157 335.32,308.926 335.425,308.695 335.53,308.462 \n",
       "  335.635,308.228 335.74,307.992 335.845,307.756 335.95,307.517 336.055,307.278 336.16,307.037 336.265,306.794 336.37,306.551 336.475,306.306 336.58,306.059 \n",
       "  336.685,305.811 336.79,305.562 336.895,305.312 337,305.06 337.105,304.806 337.21,304.552 337.315,304.296 337.42,304.038 337.525,303.779 337.63,303.519 \n",
       "  337.735,303.258 337.84,302.995 337.945,302.73 338.05,302.464 338.155,302.197 338.26,301.929 338.365,301.659 338.47,301.387 338.575,301.115 338.68,300.84 \n",
       "  338.785,300.565 338.89,300.288 338.995,300.009 339.1,299.729 339.205,299.448 339.31,299.165 339.415,298.881 339.52,298.596 339.625,298.309 339.73,298.02 \n",
       "  339.835,297.731 339.94,297.439 340.045,297.146 340.15,296.852 340.255,296.557 340.36,296.26 340.465,295.961 340.57,295.661 340.675,295.36 340.78,295.057 \n",
       "  340.885,294.752 340.99,294.446 341.095,294.139 341.2,293.83 341.305,293.52 341.41,293.208 341.515,292.895 341.62,292.58 341.725,292.263 341.83,291.946 \n",
       "  341.935,291.626 342.041,291.306 342.146,290.983 342.251,290.659 342.356,290.334 342.461,290.007 342.566,289.679 342.671,289.349 342.776,289.017 342.881,288.684 \n",
       "  342.986,288.349 343.091,288.013 343.196,287.675 343.301,287.336 343.406,286.995 343.511,286.653 343.616,286.309 343.721,285.963 343.826,285.616 343.931,285.267 \n",
       "  344.036,284.916 344.141,284.564 344.246,284.211 344.351,283.855 344.456,283.499 344.561,283.14 344.666,282.78 344.771,282.418 344.876,282.055 344.981,281.689 \n",
       "  345.086,281.323 345.191,280.954 345.296,280.584 345.401,280.212 345.506,279.839 345.611,279.464 345.716,279.087 345.821,278.708 345.926,278.328 346.031,277.946 \n",
       "  346.136,277.562 346.241,277.176 346.346,276.789 346.451,276.4 346.556,276.009 346.661,275.617 346.766,275.222 346.871,274.826 346.976,274.428 347.081,274.028 \n",
       "  347.186,273.627 347.291,273.224 347.396,272.818 347.501,272.411 347.606,272.002 347.711,271.592 347.816,271.179 347.921,270.765 348.026,270.348 348.131,269.93 \n",
       "  348.236,269.51 348.341,269.088 348.446,268.664 348.551,268.238 348.656,267.81 348.761,267.38 348.866,266.948 348.971,266.515 349.076,266.079 349.181,265.641 \n",
       "  349.286,265.201 349.391,264.76 349.496,264.316 349.601,263.87 349.706,263.422 349.811,262.972 349.916,262.52 350.021,262.066 350.127,261.61 350.232,261.152 \n",
       "  350.337,260.691 350.442,260.229 350.547,259.764 350.652,259.297 350.757,258.828 350.862,258.356 350.967,257.883 351.072,257.407 351.177,256.929 351.282,256.449 \n",
       "  351.387,255.967 351.492,255.482 351.597,254.995 351.702,254.505 351.807,254.014 351.912,253.52 352.017,253.023 352.122,252.525 352.227,252.024 352.332,251.52 \n",
       "  352.437,251.014 352.542,250.506 352.647,249.995 352.752,249.482 352.857,248.966 352.962,248.448 353.067,247.927 353.172,247.404 353.277,246.878 353.382,246.349 \n",
       "  353.487,245.818 353.592,245.284 353.697,244.748 353.802,244.209 353.907,243.668 354.012,243.123 354.117,242.576 354.222,242.027 354.327,241.474 354.432,240.919 \n",
       "  354.537,240.361 354.642,239.8 354.747,239.237 354.852,238.67 354.957,238.101 355.062,237.528 355.167,236.953 355.272,236.375 355.377,235.794 355.482,235.21 \n",
       "  355.587,234.623 355.692,234.033 355.797,233.44 355.902,232.844 356.007,232.245 356.112,231.643 356.217,231.037 356.322,230.429 356.427,229.817 356.532,229.202 \n",
       "  356.637,228.584 356.742,227.962 356.847,227.338 356.952,226.71 357.057,226.079 357.162,225.444 357.267,224.806 357.372,224.165 357.477,223.52 357.582,222.872 \n",
       "  357.687,222.221 357.792,221.566 357.897,220.907 358.002,220.245 358.107,219.58 358.213,218.911 358.318,218.238 358.423,217.562 358.528,216.882 358.633,216.199 \n",
       "  358.738,215.512 358.843,214.821 358.948,214.127 359.053,213.429 359.158,212.727 359.263,212.022 359.368,211.313 359.473,210.6 359.578,209.883 359.683,209.163 \n",
       "  359.788,208.439 359.893,207.711 359.998,206.979 360.103,206.244 360.208,205.504 360.313,204.761 360.418,204.014 360.523,203.264 360.628,202.51 360.733,201.751 \n",
       "  360.838,200.989 360.943,200.224 361.048,199.454 361.153,198.681 361.258,197.904 361.363,197.124 361.468,196.34 361.573,195.552 361.678,194.76 361.783,193.965 \n",
       "  361.888,193.167 361.993,192.365 362.098,191.559 362.203,190.75 362.308,189.938 362.413,189.122 362.518,188.303 362.623,187.481 362.728,186.656 362.833,185.828 \n",
       "  362.938,184.996 363.043,184.162 363.148,183.325 363.253,182.485 363.358,181.642 363.463,180.797 363.568,179.95 363.673,179.1 363.778,178.247 363.883,177.393 \n",
       "  363.988,176.536 364.093,175.677 364.198,174.817 364.303,173.955 364.408,173.091 364.513,172.226 364.618,171.359 364.723,170.491 364.828,169.622 364.933,168.753 \n",
       "  365.038,167.882 365.143,167.011 365.248,166.139 365.353,165.267 365.458,164.394 365.563,163.522 365.668,162.65 365.773,161.777 365.878,160.906 365.983,160.034 \n",
       "  366.088,159.164 366.193,158.294 366.299,157.425 366.404,156.557 366.509,155.691 366.614,154.825 366.719,153.962 366.824,153.1 366.929,152.24 367.034,151.381 \n",
       "  367.139,150.525 367.244,149.671 367.349,148.819 367.454,147.97 367.559,147.123 367.664,146.279 367.769,145.437 367.874,144.599 367.979,143.763 368.084,142.93 \n",
       "  368.189,142.1 368.294,141.274 368.399,140.451 368.504,139.631 368.609,138.815 368.714,138.002 368.819,137.193 368.924,136.387 369.029,135.585 369.134,134.787 \n",
       "  369.239,133.993 369.344,133.202 369.449,132.416 369.554,131.633 369.659,130.854 369.764,130.08 369.869,129.309 369.974,128.542 370.079,127.78 370.184,127.022 \n",
       "  370.289,126.267 370.394,125.517 370.499,124.771 370.604,124.03 370.709,123.292 370.814,122.559 370.919,121.829 371.024,121.104 371.129,120.384 371.234,119.667 \n",
       "  371.339,118.955 371.444,118.246 371.549,117.542 371.654,116.843 371.759,116.147 371.864,115.455 371.969,114.768 372.074,114.085 372.179,113.406 372.284,112.731 \n",
       "  372.389,112.06 372.494,111.393 372.599,110.731 372.704,110.072 372.809,109.418 372.914,108.767 373.019,108.12 373.124,107.478 373.229,106.839 373.334,106.205 \n",
       "  373.439,105.574 373.544,104.947 373.649,104.324 373.754,103.705 373.859,103.09 373.964,102.478 374.069,101.871 374.174,101.267 374.279,100.667 374.385,100.07 \n",
       "  374.49,99.4774 374.595,98.8884 374.7,98.303 374.805,97.7213 374.91,97.1432 375.015,96.5686 375.12,95.9977 375.225,95.4303 375.33,94.8664 375.435,94.306 \n",
       "  375.54,93.7491 375.645,93.1956 375.75,92.6456 375.855,92.099 375.96,91.5558 376.065,91.016 376.17,90.4794 376.275,89.9463 376.38,89.4164 376.485,88.8898 \n",
       "  376.59,88.3665 376.695,87.8464 376.8,87.3295 376.905,86.8159 377.01,86.3054 377.115,85.7981 377.22,85.2939 377.325,84.7928 377.43,84.2948 377.535,83.8 \n",
       "  377.64,83.3081 377.745,82.8194 377.85,82.3336 377.955,81.8509 378.06,81.3711 378.165,80.8943 378.27,80.4205 378.375,79.9496 378.48,79.4816 378.585,79.0165 \n",
       "  378.69,78.5543 378.795,78.095 378.9,77.6385 379.005,77.1848 379.11,76.734 379.215,76.2859 379.32,75.8407 379.425,75.3982 379.53,74.9585 379.635,74.5215 \n",
       "  379.74,74.0872 379.845,73.6556 379.95,73.2267 380.055,72.8005 380.16,72.377 380.265,71.9561 380.37,71.5379 380.475,71.1222 380.58,70.7092 380.685,70.2988 \n",
       "  380.79,69.8909 380.895,69.4857 381,69.0829 381.105,68.6828 381.21,68.2851 381.315,67.89 381.42,67.4973 381.525,67.1072 381.63,66.7196 381.735,66.3344 \n",
       "  381.84,65.9516 381.945,65.5714 382.05,65.1935 382.155,64.8181 382.26,64.4451 382.365,64.0745 382.471,63.7062 382.576,63.3404 382.681,62.9769 382.786,62.6158 \n",
       "  382.891,62.2571 382.996,61.9006 383.101,61.5465 383.206,61.1948 383.311,60.8453 383.416,60.4981 383.521,60.1533 383.626,59.8107 383.731,59.4703 383.836,59.1323 \n",
       "  383.941,58.7965 384.046,58.4629 384.151,58.1316 384.256,57.8025 384.361,57.4756 384.466,57.151 384.571,56.8285 384.676,56.5083 384.781,56.1902 384.886,55.8743 \n",
       "  384.991,55.5606 385.096,55.249 385.201,54.9396 385.306,54.6324 385.411,54.3273 385.516,54.0243 385.621,53.7235 385.726,53.4247 385.831,53.1281 385.936,52.8336 \n",
       "  386.041,52.5412 386.146,52.2509 386.251,51.9627 386.356,51.6765 386.461,51.3925 386.566,51.1105 386.671,50.8305 386.776,50.5526 386.881,50.2768 386.986,50.003 \n",
       "  387.091,49.7312 387.196,49.4615 387.301,49.1938 387.406,48.9281 387.511,48.6644 387.616,48.4028 387.721,48.1431 387.826,47.8855 387.931,47.6298 388.036,47.3761 \n",
       "  388.141,47.1244 388.246,46.8747 388.351,46.6269 388.456,46.3811 388.561,46.1373 388.666,45.8954 388.771,45.6555 388.876,45.4176 388.981,45.1815 389.086,44.9474 \n",
       "  389.191,44.7153 389.296,44.4851 389.401,44.2568 389.506,44.0304 389.611,43.8059 389.716,43.5834 389.821,43.3627 389.926,43.144 390.031,42.9271 390.136,42.7122 \n",
       "  390.241,42.4991 390.346,42.2879 390.451,42.0786 390.557,41.8712 390.662,41.6657 390.767,41.462 390.872,41.2602 390.977,41.0603 391.082,40.8622 391.187,40.666 \n",
       "  391.292,40.4717 391.397,40.2791 391.502,40.0885 391.607,39.8997 391.712,39.7127 391.817,39.5275 391.922,39.3442 392.027,39.1627 392.132,38.9831 392.237,38.8052 \n",
       "  392.342,38.6292 392.447,38.455 392.552,38.2826 392.657,38.1121 392.762,37.9433 392.867,37.7763 392.972,37.6112 393.077,37.4478 393.182,37.2862 393.287,37.1265 \n",
       "  393.392,36.9685 393.497,36.8123 393.602,36.6579 393.707,36.5053 393.812,36.3544 393.917,36.2053 394.022,36.0581 394.127,35.9125 394.232,35.7688 394.337,35.6268 \n",
       "  394.442,35.4866 394.547,35.3481 394.652,35.2114 394.757,35.0764 394.862,34.9433 394.967,34.8118 395.072,34.6821 395.177,34.5542 395.282,34.428 395.387,34.3035 \n",
       "  395.492,34.1808 395.597,34.0598 395.702,33.9406 395.807,33.8231 395.912,33.7073 396.017,33.5932 396.122,33.4809 396.227,33.3703 396.332,33.2614 396.437,33.1543 \n",
       "  396.542,33.0488 396.647,32.9451 396.752,32.8431 396.857,32.7428 396.962,32.6442 397.067,32.5473 397.172,32.4522 397.277,32.3587 397.382,32.2669 397.487,32.1768 \n",
       "  397.592,32.0885 397.697,32.0018 397.802,31.9168 397.907,31.8335 398.012,31.752 398.117,31.672 398.222,31.5938 398.327,31.5173 398.432,31.4424 398.537,31.3693 \n",
       "  398.643,31.2978 398.748,31.228 398.853,31.1599 398.958,31.0934 399.063,31.0286 399.168,30.9655 399.273,30.904 399.378,30.8443 399.483,30.7862 399.588,30.7297 \n",
       "  399.693,30.6749 399.798,30.6218 399.903,30.5703 400.008,30.5205 400.113,30.4724 400.218,30.4259 400.323,30.381 400.428,30.3378 400.533,30.2963 400.638,30.2564 \n",
       "  400.743,30.2181 400.848,30.1815 400.953,30.1466 401.058,30.1132 401.163,30.0816 401.268,30.0515 401.373,30.0231 401.478,29.9963 401.583,29.9712 401.688,29.9477 \n",
       "  401.793,29.9258 401.898,29.9056 402.003,29.887 402.108,29.87 402.213,29.8546 402.318,29.8408 402.423,29.8287 402.528,29.8182 402.633,29.8093 402.738,29.8021 \n",
       "  402.843,29.7964 402.948,29.7924 403.053,29.7899 403.158,29.7891 403.263,29.7899 403.368,29.7923 403.473,29.7963 403.578,29.8019 403.683,29.8092 403.788,29.818 \n",
       "  403.893,29.8284 403.998,29.8404 404.103,29.854 404.208,29.8692 404.313,29.8861 404.418,29.9045 404.523,29.9244 404.628,29.946 404.733,29.9692 404.838,29.994 \n",
       "  404.943,30.0203 405.048,30.0483 405.153,30.0778 405.258,30.1089 405.363,30.1416 405.468,30.1758 405.573,30.2117 405.678,30.2491 405.783,30.2881 405.888,30.3286 \n",
       "  405.993,30.3708 406.098,30.4145 406.203,30.4598 406.308,30.5066 406.413,30.555 406.518,30.605 406.623,30.6565 406.728,30.7096 406.834,30.7643 406.939,30.8205 \n",
       "  407.044,30.8783 407.149,30.9377 407.254,30.9986 407.359,31.061 407.464,31.125 407.569,31.1906 407.674,31.2577 407.779,31.3263 407.884,31.3966 407.989,31.4683 \n",
       "  408.094,31.5416 408.199,31.6164 408.304,31.6928 408.409,31.7708 408.514,31.8502 408.619,31.9312 408.724,32.0138 408.829,32.0978 408.934,32.1834 409.039,32.2706 \n",
       "  409.144,32.3593 409.249,32.4495 409.354,32.5412 409.459,32.6345 409.564,32.7292 409.669,32.8256 409.774,32.9234 409.879,33.0228 409.984,33.1236 410.089,33.226 \n",
       "  410.194,33.3299 410.299,33.4354 410.404,33.5423 410.509,33.6508 410.614,33.7608 410.719,33.8723 410.824,33.9853 410.929,34.0998 411.034,34.2158 411.139,34.3333 \n",
       "  411.244,34.4523 411.349,34.5729 411.454,34.6949 411.559,34.8185 411.664,34.9435 411.769,35.07 411.874,35.1981 411.979,35.3276 412.084,35.4586 412.189,35.5912 \n",
       "  412.294,35.7252 412.399,35.8607 412.504,35.9977 412.609,36.1362 412.714,36.2761 412.819,36.4176 412.924,36.5605 413.029,36.705 413.134,36.8509 413.239,36.9983 \n",
       "  413.344,37.1472 413.449,37.2975 413.554,37.4494 413.659,37.6027 413.764,37.7575 413.869,37.9138 413.974,38.0715 414.079,38.2307 414.184,38.3914 414.289,38.5536 \n",
       "  414.394,38.7172 414.499,38.8823 414.604,39.0488 414.709,39.2169 414.814,39.3864 414.92,39.5573 415.025,39.7298 415.13,39.9036 415.235,40.079 415.34,40.2558 \n",
       "  415.445,40.4341 415.55,40.6138 415.655,40.795 415.76,40.9776 415.865,41.1617 415.97,41.3473 416.075,41.5343 416.18,41.7227 416.285,41.9126 416.39,42.104 \n",
       "  416.495,42.2968 416.6,42.491 416.705,42.6867 416.81,42.8839 416.915,43.0825 417.02,43.2825 417.125,43.484 417.23,43.6869 417.335,43.8913 417.44,44.0971 \n",
       "  417.545,44.3044 417.65,44.5131 417.755,44.7232 417.86,44.9348 417.965,45.1478 418.07,45.3623 418.175,45.5782 418.28,45.7955 418.385,46.0143 418.49,46.2345 \n",
       "  418.595,46.4561 418.7,46.6792 418.805,46.9037 418.91,47.1296 419.015,47.357 419.12,47.5858 419.225,47.816 419.33,48.0477 419.435,48.2808 419.54,48.5153 \n",
       "  419.645,48.7512 419.75,48.9886 419.855,49.2274 419.96,49.4677 420.065,49.7093 420.17,49.9524 420.275,50.197 420.38,50.4429 420.485,50.6903 420.59,50.9391 \n",
       "  420.695,51.1893 420.8,51.441 420.905,51.6941 421.01,51.9486 421.115,52.2045 421.22,52.4619 421.325,52.7207 421.43,52.9809 421.535,53.2426 421.64,53.5056 \n",
       "  421.745,53.7701 421.85,54.036 421.955,54.3034 422.06,54.5722 422.165,54.8424 422.27,55.114 422.375,55.3871 422.48,55.6615 422.585,55.9375 422.69,56.2148 \n",
       "  422.795,56.4936 422.9,56.7738 423.006,57.0554 423.111,57.3384 423.216,57.6229 423.321,57.9088 423.426,58.1962 423.531,58.485 423.636,58.7752 423.741,59.0668 \n",
       "  423.846,59.3599 423.951,59.6544 424.056,59.9504 424.161,60.2478 424.266,60.5466 424.371,60.8468 424.476,61.1485 424.581,61.4517 424.686,61.7563 424.791,62.0623 \n",
       "  424.896,62.3697 425.001,62.6787 425.106,62.989 425.211,63.3008 425.316,63.6141 425.421,63.9287 425.526,64.2449 425.631,64.5625 425.736,64.8815 425.841,65.202 \n",
       "  425.946,65.524 426.051,65.8474 426.156,66.1723 426.261,66.4986 426.366,66.8264 426.471,67.1557 426.576,67.4864 426.681,67.8186 426.786,68.1523 426.891,68.4874 \n",
       "  426.996,68.8241 427.101,69.1621 427.206,69.5017 427.311,69.8428 427.416,70.1853 427.521,70.5293 427.626,70.8748 427.731,71.2218 427.836,71.5703 427.941,71.9202 \n",
       "  428.046,72.2717 428.151,72.6247 428.256,72.9792 428.361,73.3351 428.466,73.6926 428.571,74.0516 428.676,74.4121 428.781,74.7742 428.886,75.1377 428.991,75.5028 \n",
       "  429.096,75.8694 429.201,76.2375 429.306,76.6071 429.411,76.9783 429.516,77.3511 429.621,77.7253 429.726,78.1011 429.831,78.4785 429.936,78.8574 430.041,79.2379 \n",
       "  430.146,79.6199 430.251,80.0035 430.356,80.3887 430.461,80.7755 430.566,81.1638 430.671,81.5537 430.776,81.9452 430.881,82.3383 430.986,82.7329 431.092,83.1292 \n",
       "  431.197,83.5271 431.302,83.9266 431.407,84.3277 431.512,84.7304 431.617,85.1348 431.722,85.5408 431.827,85.9484 431.932,86.3576 432.037,86.7685 432.142,87.1811 \n",
       "  432.247,87.5953 432.352,88.0111 432.457,88.4287 432.562,88.8479 432.667,89.2687 432.772,89.6913 432.877,90.1156 432.982,90.5415 433.087,90.9692 433.192,91.3986 \n",
       "  433.297,91.8297 433.402,92.2625 433.507,92.697 433.612,93.1333 433.717,93.5713 433.822,94.0111 433.927,94.4527 434.032,94.896 434.137,95.341 434.242,95.7879 \n",
       "  434.347,96.2366 434.452,96.687 434.557,97.1393 434.662,97.5933 434.767,98.0492 434.872,98.5069 434.977,98.9665 435.082,99.4279 435.187,99.8911 435.292,100.356 \n",
       "  435.397,100.823 435.502,101.292 435.607,101.763 435.712,102.236 435.817,102.71 435.922,103.187 436.027,103.665 436.132,104.145 436.237,104.628 436.342,105.112 \n",
       "  436.447,105.598 436.552,106.087 436.657,106.577 436.762,107.069 436.867,107.563 436.972,108.059 437.077,108.558 437.182,109.058 437.287,109.561 437.392,110.065 \n",
       "  437.497,110.572 437.602,111.08 437.707,111.591 437.812,112.104 437.917,112.619 438.022,113.136 438.127,113.655 438.232,114.177 438.337,114.7 438.442,115.226 \n",
       "  438.547,115.754 438.652,116.285 438.757,116.817 438.862,117.352 438.967,117.889 439.072,118.429 439.178,118.97 439.283,119.514 439.388,120.06 439.493,120.609 \n",
       "  439.598,121.16 439.703,121.713 439.808,122.269 439.913,122.827 440.018,123.388 440.123,123.951 440.228,124.516 440.333,125.084 440.438,125.655 440.543,126.228 \n",
       "  440.648,126.803 440.753,127.381 440.858,127.962 440.963,128.545 441.068,129.131 441.173,129.719 441.278,130.31 441.383,130.903 441.488,131.5 441.593,132.099 \n",
       "  441.698,132.7 441.803,133.305 441.908,133.912 442.013,134.522 442.118,135.134 442.223,135.75 442.328,136.368 442.433,136.989 442.538,137.613 442.643,138.24 \n",
       "  442.748,138.87 442.853,139.503 442.958,140.138 443.063,140.777 443.168,141.419 443.273,142.063 443.378,142.711 443.483,143.362 443.588,144.015 443.693,144.672 \n",
       "  443.798,145.332 443.903,145.995 444.008,146.661 444.113,147.331 444.218,148.003 444.323,148.679 444.428,149.358 444.533,150.04 444.638,150.726 444.743,151.414 \n",
       "  444.848,152.106 444.953,152.802 445.058,153.501 445.163,154.203 445.268,154.908 445.373,155.617 445.478,156.329 445.583,157.045 445.688,157.764 445.793,158.487 \n",
       "  445.898,159.213 446.003,159.943 446.108,160.676 446.213,161.412 446.318,162.152 446.423,162.896 446.528,163.643 446.633,164.394 446.738,165.148 446.843,165.906 \n",
       "  446.948,166.667 447.053,167.432 447.158,168.201 447.264,168.973 447.369,169.749 447.474,170.528 447.579,171.311 447.684,172.097 447.789,172.887 447.894,173.68 \n",
       "  447.999,174.477 448.104,175.278 448.209,176.082 448.314,176.889 448.419,177.7 448.524,178.514 448.629,179.332 448.734,180.153 448.839,180.977 448.944,181.805 \n",
       "  449.049,182.636 449.154,183.47 449.259,184.308 449.364,185.148 449.469,185.992 449.574,186.838 449.679,187.688 449.784,188.54 449.889,189.395 449.994,190.253 \n",
       "  450.099,191.114 450.204,191.977 450.309,192.843 450.414,193.711 450.519,194.582 450.624,195.455 450.729,196.33 450.834,197.207 450.939,198.086 451.044,198.967 \n",
       "  451.149,199.85 451.254,200.734 451.359,201.62 451.464,202.507 451.569,203.396 451.674,204.286 451.779,205.177 451.884,206.069 451.989,206.961 452.094,207.855 \n",
       "  452.199,208.749 452.304,209.643 452.409,210.537 452.514,211.432 452.619,212.327 452.724,213.221 452.829,214.115 452.934,215.009 453.039,215.903 453.144,216.795 \n",
       "  453.249,217.687 453.354,218.578 453.459,219.468 453.564,220.356 453.669,221.243 453.774,222.129 453.879,223.013 453.984,223.895 454.089,224.776 454.194,225.655 \n",
       "  454.299,226.531 454.404,227.405 454.509,228.278 454.614,229.147 454.719,230.014 454.824,230.879 454.929,231.741 455.034,232.6 455.139,233.456 455.244,234.309 \n",
       "  455.35,235.159 455.455,236.006 455.56,236.85 455.665,237.691 455.77,238.528 455.875,239.362 455.98,240.192 456.085,241.019 456.19,241.843 456.295,242.662 \n",
       "  456.4,243.478 456.505,244.291 456.61,245.099 456.715,245.904 456.82,246.705 456.925,247.503 457.03,248.296 457.135,249.085 457.24,249.871 457.345,250.653 \n",
       "  457.45,251.43 457.555,252.204 457.66,252.974 457.765,253.739 457.87,254.501 457.975,255.259 458.08,256.013 458.185,256.762 458.29,257.508 458.395,258.25 \n",
       "  458.5,258.988 458.605,259.721 458.71,260.451 458.815,261.177 458.92,261.898 459.025,262.616 459.13,263.33 459.235,264.04 459.34,264.745 459.445,265.447 \n",
       "  459.55,266.145 459.655,266.839 459.76,267.53 459.865,268.216 459.97,268.898 460.075,269.577 460.18,270.252 460.285,270.923 460.39,271.59 460.495,272.253 \n",
       "  460.6,272.913 460.705,273.569 460.81,274.221 460.915,274.87 461.02,275.515 461.125,276.156 461.23,276.793 461.335,277.427 461.44,278.058 461.545,278.684 \n",
       "  461.65,279.308 461.755,279.927 461.86,280.544 461.965,281.156 462.07,281.766 462.175,282.371 462.28,282.974 462.385,283.573 462.49,284.168 462.595,284.76 \n",
       "  462.7,285.349 462.805,285.935 462.91,286.517 463.015,287.096 463.12,287.672 463.225,288.244 463.33,288.814 463.436,289.38 463.541,289.943 463.646,290.502 \n",
       "  463.751,291.059 463.856,291.612 463.961,292.163 464.066,292.71 464.171,293.254 464.276,293.795 464.381,294.333 464.486,294.869 464.591,295.401 464.696,295.93 \n",
       "  464.801,296.456 464.906,296.979 465.011,297.5 465.116,298.017 465.221,298.532 465.326,299.044 465.431,299.553 465.536,300.059 465.641,300.562 465.746,301.062 \n",
       "  465.851,301.56 465.956,302.055 466.061,302.547 466.166,303.036 466.271,303.523 466.376,304.007 466.481,304.488 466.586,304.967 466.691,305.443 466.796,305.916 \n",
       "  466.901,306.387 467.006,306.855 467.111,307.32 467.216,307.783 467.321,308.243 467.426,308.701 467.531,309.156 467.636,309.609 467.741,310.059 467.846,310.506 \n",
       "  467.951,310.951 468.056,311.394 468.161,311.834 468.266,312.272 468.371,312.707 468.476,313.14 468.581,313.57 468.686,313.998 468.791,314.423 468.896,314.846 \n",
       "  469.001,315.267 469.106,315.686 469.211,316.101 469.316,316.515 469.421,316.926 469.526,317.335 469.631,317.742 469.736,318.146 469.841,318.548 469.946,318.948 \n",
       "  470.051,319.345 470.156,319.74 470.261,320.133 470.366,320.524 470.471,320.912 470.576,321.298 470.681,321.682 470.786,322.064 470.891,322.443 470.996,322.821 \n",
       "  471.101,323.196 471.206,323.569 471.311,323.939 471.416,324.308 471.522,324.674 471.627,325.038 471.732,325.4 471.837,325.76 471.942,326.118 472.047,326.474 \n",
       "  472.152,326.827 472.257,327.179 472.362,327.528 472.467,327.875 472.572,328.22 472.677,328.563 472.782,328.904 472.887,329.243 472.992,329.58 473.097,329.915 \n",
       "  473.202,330.247 473.307,330.578 473.412,330.906 473.517,331.233 473.622,331.558 473.727,331.88 473.832,332.2 473.937,332.519 474.042,332.835 474.147,333.15 \n",
       "  474.252,333.462 474.357,333.773 474.462,334.081 474.567,334.388 474.672,334.692 474.777,334.995 474.882,335.295 474.987,335.594 475.092,335.89 475.197,336.185 \n",
       "  475.302,336.478 475.407,336.769 475.512,337.057 475.617,337.344 475.722,337.629 475.827,337.912 475.932,338.193 476.037,338.473 476.142,338.75 476.247,339.025 \n",
       "  476.352,339.299 476.457,339.57 476.562,339.84 476.667,340.108 476.772,340.374 476.877,340.638 476.982,340.9 477.087,341.16 477.192,341.418 477.297,341.675 \n",
       "  477.402,341.929 477.507,342.182 477.612,342.433 477.717,342.682 477.822,342.929 477.927,343.174 478.032,343.418 478.137,343.659 478.242,343.899 478.347,344.137 \n",
       "  478.452,344.373 478.557,344.607 478.662,344.839 478.767,345.07 478.872,345.299 478.977,345.525 479.082,345.751 479.187,345.974 479.292,346.195 479.397,346.415 \n",
       "  479.502,346.633 479.608,346.849 479.713,347.063 479.818,347.275 479.923,347.486 480.028,347.694 480.133,347.901 480.238,348.106 480.343,348.31 480.448,348.511 \n",
       "  480.553,348.711 480.658,348.909 480.763,349.105 480.868,349.3 480.973,349.492 481.078,349.683 481.183,349.872 481.288,350.06 481.393,350.245 481.498,350.429 \n",
       "  481.603,350.611 481.708,350.791 481.813,350.97 481.918,351.146 482.023,351.321 482.128,351.494 482.233,351.666 482.338,351.835 482.443,352.003 482.548,352.169 \n",
       "  482.653,352.334 482.758,352.496 482.863,352.657 482.968,352.816 483.073,352.974 483.178,353.129 483.283,353.283 483.388,353.435 483.493,353.586 483.598,353.734 \n",
       "  483.703,353.881 483.808,354.026 483.913,354.17 484.018,354.311 484.123,354.451 484.228,354.59 484.333,354.726 484.438,354.861 484.543,354.994 484.648,355.125 \n",
       "  484.753,355.255 484.858,355.383 484.963,355.509 485.068,355.633 485.173,355.756 485.278,355.877 485.383,355.996 485.488,356.113 485.593,356.229 485.698,356.343 \n",
       "  485.803,356.456 485.908,356.566 486.013,356.675 486.118,356.782 486.223,356.888 486.328,356.992 486.433,357.094 486.538,357.194 486.643,357.293 486.748,357.39 \n",
       "  486.853,357.485 486.958,357.579 487.063,357.671 487.168,357.761 487.273,357.849 487.378,357.936 487.483,358.021 487.588,358.104 487.694,358.186 487.799,358.266 \n",
       "  487.904,358.344 488.009,358.421 488.114,358.496 488.219,358.569 488.324,358.64 488.429,358.71 488.534,358.778 488.639,358.844 488.744,358.909 488.849,358.972 \n",
       "  488.954,359.033 489.059,359.093 489.164,359.151 489.269,359.207 489.374,359.262 489.479,359.315 489.584,359.366 489.689,359.415 489.794,359.463 489.899,359.509 \n",
       "  490.004,359.554 490.109,359.596 490.214,359.638 490.319,359.677 490.424,359.715 490.529,359.751 490.634,359.785 490.739,359.818 490.844,359.849 490.949,359.878 \n",
       "  491.054,359.906 491.159,359.932 491.264,359.956 491.369,359.979 491.474,360 491.579,360.019 491.684,360.037 491.789,360.052 491.894,360.067 491.999,360.079 \n",
       "  492.104,360.09 492.209,360.099 492.314,360.107 492.419,360.113 492.524,360.117 492.629,360.12 492.734,360.121 492.839,360.12 492.944,360.117 493.049,360.113 \n",
       "  493.154,360.108 493.259,360.1 493.364,360.091 493.469,360.08 493.574,360.068 493.679,360.054 493.784,360.038 493.889,360.021 493.994,360.002 494.099,359.981 \n",
       "  494.204,359.958 494.309,359.934 494.414,359.909 494.519,359.881 494.624,359.852 494.729,359.822 494.834,359.789 494.939,359.755 495.044,359.72 495.149,359.682 \n",
       "  495.254,359.643 495.359,359.603 495.464,359.56 495.569,359.516 495.674,359.471 495.78,359.424 495.885,359.375 495.99,359.324 496.095,359.272 496.2,359.218 \n",
       "  496.305,359.163 496.41,359.106 496.515,359.047 496.62,358.986 496.725,358.924 496.83,358.86 496.935,358.795 497.04,358.728 497.145,358.659 497.25,358.589 \n",
       "  497.355,358.517 497.46,358.443 497.565,358.368 497.67,358.291 497.775,358.212 497.88,358.132 497.985,358.05 498.09,357.967 498.195,357.882 498.3,357.795 \n",
       "  498.405,357.706 498.51,357.616 498.615,357.525 498.72,357.431 498.825,357.336 498.93,357.24 499.035,357.141 499.14,357.041 499.245,356.94 499.35,356.836 \n",
       "  499.455,356.732 499.56,356.625 499.665,356.517 499.77,356.407 499.875,356.296 499.98,356.183 500.085,356.068 500.19,355.952 500.295,355.834 500.4,355.714 \n",
       "  500.505,355.593 500.61,355.47 500.715,355.345 500.82,355.219 500.925,355.091 501.03,354.962 501.135,354.831 501.24,354.698 501.345,354.564 501.45,354.428 \n",
       "  501.555,354.29 501.66,354.151 501.765,354.01 501.87,353.867 501.975,353.723 502.08,353.578 502.185,353.43 502.29,353.281 502.395,353.13 502.5,352.978 \n",
       "  502.605,352.824 502.71,352.668 502.815,352.511 502.92,352.352 503.025,352.192 503.13,352.03 503.235,351.866 503.34,351.7 503.445,351.533 503.55,351.365 \n",
       "  503.655,351.194 503.76,351.022 503.866,350.849 503.971,350.673 504.076,350.496 504.181,350.318 504.286,350.138 504.391,349.956 504.496,349.773 504.601,349.588 \n",
       "  504.706,349.401 504.811,349.212 504.916,349.023 505.021,348.831 505.126,348.638 505.231,348.443 505.336,348.246 505.441,348.048 505.546,347.848 505.651,347.647 \n",
       "  505.756,347.444 505.861,347.239 505.966,347.033 506.071,346.825 506.176,346.615 506.281,346.404 506.386,346.191 506.491,345.976 506.596,345.76 506.701,345.542 \n",
       "  506.806,345.322 506.911,345.101 507.016,344.878 507.121,344.654 507.226,344.428 507.331,344.2 507.436,343.971 507.541,343.74 507.646,343.507 507.751,343.273 \n",
       "  507.856,343.037 507.961,342.799 508.066,342.559 508.171,342.318 508.276,342.076 508.381,341.832 508.486,341.586 508.591,341.338 508.696,341.089 508.801,340.838 \n",
       "  508.906,340.585 509.011,340.331 509.116,340.075 509.221,339.817 509.326,339.558 509.431,339.297 509.536,339.034 509.641,338.77 509.746,338.504 509.851,338.236 \n",
       "  509.956,337.967 510.061,337.696 510.166,337.423 510.271,337.149 510.376,336.873 510.481,336.595 510.586,336.316 510.691,336.035 510.796,335.752 510.901,335.467 \n",
       "  511.006,335.181 511.111,334.893 511.216,334.604 511.321,334.313 511.426,334.02 511.531,333.725 511.636,333.428 511.741,333.13 511.846,332.831 511.952,332.529 \n",
       "  512.057,332.226 512.162,331.921 512.267,331.614 512.372,331.306 512.477,330.996 512.582,330.684 512.687,330.37 512.792,330.055 512.897,329.738 513.002,329.419 \n",
       "  513.107,329.098 513.212,328.776 513.317,328.452 513.422,328.126 513.527,327.799 513.632,327.469 513.737,327.138 513.842,326.805 513.947,326.471 514.052,326.134 \n",
       "  514.157,325.796 514.262,325.456 514.367,325.115 514.472,324.771 514.577,324.426 514.682,324.079 514.787,323.73 514.892,323.379 514.997,323.027 515.102,322.673 \n",
       "  515.207,322.316 515.312,321.959 515.417,321.599 515.522,321.237 515.627,320.874 515.732,320.509 515.837,320.142 515.942,319.773 516.047,319.402 516.152,319.029 \n",
       "  516.257,318.655 516.362,318.279 516.467,317.9 516.572,317.52 516.677,317.138 516.782,316.755 516.887,316.369 516.992,315.981 517.097,315.592 517.202,315.2 \n",
       "  517.307,314.807 517.412,314.412 517.517,314.015 517.622,313.615 517.727,313.214 517.832,312.811 517.937,312.407 518.042,312 518.147,311.591 518.252,311.18 \n",
       "  518.357,310.767 518.462,310.352 518.567,309.936 518.672,309.517 518.777,309.096 518.882,308.673 518.987,308.249 519.092,307.822 519.197,307.393 519.302,306.962 \n",
       "  519.407,306.529 519.512,306.094 519.617,305.657 519.722,305.218 519.827,304.777 519.932,304.333 520.038,303.888 520.143,303.44 520.248,302.991 520.353,302.539 \n",
       "  520.458,302.085 520.563,301.629 520.668,301.171 520.773,300.71 520.878,300.248 520.983,299.783 521.088,299.316 521.193,298.847 521.298,298.376 521.403,297.902 \n",
       "  521.508,297.426 521.613,296.948 521.718,296.468 521.823,295.985 521.928,295.5 522.033,295.013 522.138,294.524 522.243,294.032 522.348,293.538 522.453,293.041 \n",
       "  522.558,292.543 522.663,292.041 522.768,291.538 522.873,291.032 522.978,290.524 523.083,290.013 523.188,289.5 523.293,288.984 523.398,288.466 523.503,287.945 \n",
       "  523.608,287.422 523.713,286.897 523.818,286.369 523.923,285.838 524.028,285.305 524.133,284.769 524.238,284.231 524.343,283.69 524.448,283.147 524.553,282.601 \n",
       "  524.658,282.052 524.763,281.501 524.868,280.946 524.973,280.39 525.078,279.83 525.183,279.268 525.288,278.703 525.393,278.136 525.498,277.565 525.603,276.992 \n",
       "  525.708,276.416 525.813,275.837 525.918,275.256 526.023,274.671 526.128,274.084 526.233,273.493 526.338,272.9 526.443,272.304 526.548,271.705 526.653,271.103 \n",
       "  526.758,270.498 526.863,269.89 526.968,269.279 527.073,268.664 527.178,268.047 527.283,267.427 527.388,266.803 527.493,266.177 527.598,265.547 527.703,264.914 \n",
       "  527.808,264.278 527.913,263.639 528.018,262.996 528.124,262.351 528.229,261.702 528.334,261.049 528.439,260.393 528.544,259.734 528.649,259.072 528.754,258.406 \n",
       "  528.859,257.737 528.964,257.065 529.069,256.389 529.174,255.709 529.279,255.026 529.384,254.34 529.489,253.65 529.594,252.956 529.699,252.259 529.804,251.558 \n",
       "  529.909,250.854 530.014,250.146 530.119,249.435 530.224,248.72 530.329,248.001 530.434,247.278 530.539,246.552 530.644,245.822 530.749,245.089 530.854,244.351 \n",
       "  530.959,243.61 531.064,242.865 531.169,242.117 531.274,241.364 531.379,240.608 531.484,239.848 531.589,239.084 531.694,238.316 531.799,237.545 531.904,236.77 \n",
       "  532.009,235.991 532.114,235.208 532.219,234.421 532.324,233.631 532.429,232.836 532.534,232.038 532.639,231.236 532.744,230.431 532.849,229.621 532.954,228.808 \n",
       "  533.059,227.991 533.164,227.171 533.269,226.346 533.374,225.518 533.479,224.687 533.584,223.852 533.689,223.013 533.794,222.171 533.899,221.325 534.004,220.476 \n",
       "  534.109,219.624 534.214,218.768 534.319,217.909 534.424,217.046 534.529,216.181 534.634,215.312 534.739,214.441 534.844,213.566 534.949,212.689 535.054,211.809 \n",
       "  535.159,210.926 535.264,210.04 535.369,209.152 535.474,208.262 535.579,207.369 535.684,206.474 535.789,205.576 535.894,204.677 535.999,203.776 536.104,202.873 \n",
       "  536.21,201.968 536.315,201.062 536.42,200.154 536.525,199.245 536.63,198.335 536.735,197.423 536.84,196.511 536.945,195.598 537.05,194.684 537.155,193.77 \n",
       "  537.26,192.855 537.365,191.94 537.47,191.025 537.575,190.11 537.68,189.194 537.785,188.28 537.89,187.365 537.995,186.451 538.1,185.538 538.205,184.626 \n",
       "  538.31,183.714 538.415,182.804 538.52,181.895 538.625,180.987 538.73,180.08 538.835,179.175 538.94,178.272 539.045,177.371 539.15,176.471 539.255,175.573 \n",
       "  539.36,174.678 539.465,173.785 539.57,172.894 539.675,172.005 539.78,171.119 539.885,170.236 539.99,169.355 540.095,168.477 540.2,167.602 540.305,166.73 \n",
       "  540.41,165.861 540.515,164.995 540.62,164.131 540.725,163.272 540.83,162.415 540.935,161.561 541.04,160.711 541.145,159.865 541.25,159.021 541.355,158.181 \n",
       "  541.46,157.345 541.565,156.512 541.67,155.683 541.775,154.857 541.88,154.035 541.985,153.217 542.09,152.402 542.195,151.591 542.3,150.784 542.405,149.98 \n",
       "  542.51,149.18 542.615,148.384 542.72,147.591 542.825,146.802 542.93,146.017 543.035,145.236 543.14,144.458 543.245,143.685 543.35,142.914 543.455,142.148 \n",
       "  543.56,141.385 543.665,140.627 543.77,139.871 543.875,139.12 543.98,138.372 544.085,137.628 544.19,136.888 544.296,136.151 544.401,135.418 544.506,134.688 \n",
       "  544.611,133.962 544.716,133.24 544.821,132.521 544.926,131.806 545.031,131.094 545.136,130.386 545.241,129.682 545.346,128.981 545.451,128.283 545.556,127.589 \n",
       "  545.661,126.899 545.766,126.211 545.871,125.528 545.976,124.847 546.081,124.17 546.186,123.496 546.291,122.826 546.396,122.159 546.501,121.495 546.606,120.834 \n",
       "  546.711,120.177 546.816,119.523 546.921,118.872 547.026,118.224 547.131,117.58 547.236,116.938 547.341,116.3 547.446,115.664 547.551,115.032 547.656,114.403 \n",
       "  547.761,113.777 547.866,113.154 547.971,112.534 548.076,111.917 548.181,111.303 548.286,110.692 548.391,110.083 548.496,109.478 548.601,108.875 548.706,108.276 \n",
       "  548.811,107.679 548.916,107.085 549.021,106.494 549.126,105.905 549.231,105.32 549.336,104.737 549.441,104.156 549.546,103.579 549.651,103.004 549.756,102.432 \n",
       "  549.861,101.863 549.966,101.296 550.071,100.732 550.176,100.17 550.281,99.6113 550.386,99.0549 550.491,98.5011 550.596,97.9499 550.701,97.4011 550.806,96.8549 \n",
       "  550.911,96.3112 551.016,95.77 551.121,95.2312 551.226,94.6949 551.331,94.1611 551.436,93.6296 551.541,93.1006 551.646,92.574 551.751,92.0498 551.856,91.5279 \n",
       "  551.961,91.0084 552.066,90.4912 552.171,89.9764 552.276,89.4639 552.382,88.9537 552.487,88.4458 552.592,87.9401 552.697,87.4368 552.802,86.9357 552.907,86.4368 \n",
       "  553.012,85.9402 553.117,85.4458 553.222,84.9536 553.327,84.4636 553.432,83.9758 553.537,83.4902 553.642,83.0067 553.747,82.5254 553.852,82.0463 553.957,81.5693 \n",
       "  554.062,81.0944 554.167,80.6216 554.272,80.1509 554.377,79.6824 554.482,79.2159 554.587,78.7515 554.692,78.2891 554.797,77.8288 554.902,77.3706 555.007,76.9144 \n",
       "  555.112,76.4603 555.217,76.0081 555.322,75.558 555.427,75.1099 555.532,74.6638 555.637,74.2197 555.742,73.7775 555.847,73.3374 555.952,72.8992 556.057,72.4629 \n",
       "  556.162,72.0286 556.267,71.5963 556.372,71.1659 556.477,70.7374 556.582,70.3109 556.687,69.8862 556.792,69.4635 556.897,69.0427 557.002,68.6238 557.107,68.2067 \n",
       "  557.212,67.7916 557.317,67.3783 557.422,66.9669 557.527,66.5573 557.632,66.1497 557.737,65.7438 557.842,65.3399 557.947,64.9377 558.052,64.5374 558.157,64.139 \n",
       "  558.262,63.7423 558.367,63.3475 558.472,62.9545 558.577,62.5633 558.682,62.1739 558.787,61.7863 558.892,61.4005 558.997,61.0165 559.102,60.6343 559.207,60.2538 \n",
       "  559.312,59.8751 559.417,59.4982 559.522,59.1231 559.627,58.7498 559.732,58.3781 559.837,58.0083 559.942,57.6402 560.047,57.2738 560.152,56.9092 560.257,56.5464 \n",
       "  560.362,56.1852 560.468,55.8258 560.573,55.4681 560.678,55.1122 560.783,54.758 560.888,54.4054 560.993,54.0546 561.098,53.7055 561.203,53.3582 561.308,53.0125 \n",
       "  561.413,52.6685 561.518,52.3262 561.623,51.9856 561.728,51.6468 561.833,51.3096 561.938,50.974 562.043,50.6402 562.148,50.3081 562.253,49.9776 562.358,49.6488 \n",
       "  562.463,49.3217 562.568,48.9962 562.673,48.6724 562.778,48.3503 562.883,48.0299 562.988,47.7111 563.093,47.3939 563.198,47.0785 563.303,46.7646 563.408,46.4525 \n",
       "  563.513,46.142 563.618,45.8331 563.723,45.5259 563.828,45.2203 563.933,44.9164 564.038,44.6141 564.143,44.3134 564.248,44.0144 564.353,43.7171 564.458,43.4213 \n",
       "  564.563,43.1272 564.668,42.8347 564.773,42.5439 564.878,42.2547 564.983,41.9671 565.088,41.6811 565.193,41.3968 565.298,41.1141 565.403,40.833 565.508,40.5535 \n",
       "  565.613,40.2757 565.718,39.9995 565.823,39.7248 565.928,39.4518 566.033,39.1805 566.138,38.9107 566.243,38.6426 566.348,38.376 566.453,38.1111 566.558,37.8478 \n",
       "  566.663,37.5861 566.768,37.326 566.873,37.0675 566.978,36.8106 567.083,36.5553 567.188,36.3017 567.293,36.0496 567.398,35.7991 567.503,35.5503 567.608,35.303 \n",
       "  567.713,35.0574 567.818,34.8133 567.923,34.5709 568.028,34.3301 568.133,34.0908 568.238,33.8532 568.343,33.6171 568.448,33.3827 568.554,33.1499 568.659,32.9186 \n",
       "  568.764,32.689 568.869,32.4609 568.974,32.2345 569.079,32.0097 569.184,31.7864 569.289,31.5648 569.394,31.3447 569.499,31.1263 569.604,30.9094 569.709,30.6941 \n",
       "  569.814,30.4805 569.919,30.2684 570.024,30.0579 570.129,29.8491 570.234,29.6418 570.339,29.4361 570.444,29.232 570.549,29.0296 570.654,28.8287 570.759,28.6294 \n",
       "  570.864,28.4317 570.969,28.2356 571.074,28.0411 571.179,27.8482 571.284,27.6569 571.389,27.4672 571.494,27.2791 571.599,27.0926 571.704,26.9076 571.809,26.7243 \n",
       "  571.914,26.5426 572.019,26.3625 572.124,26.184 572.229,26.0071 572.334,25.8317 572.439,25.658 572.544,25.4859 572.649,25.3154 572.754,25.1465 572.859,24.9792 \n",
       "  572.964,24.8134 573.069,24.6493 573.174,24.4868 573.279,24.3259 573.384,24.1666 573.489,24.0089 573.594,23.8528 573.699,23.6983 573.804,23.5454 573.909,23.3942 \n",
       "  574.014,23.2445 574.119,23.0964 574.224,22.95 574.329,22.8051 574.434,22.6619 574.539,22.5202 574.644,22.3802 574.749,22.2418 574.854,22.105 574.959,21.9698 \n",
       "  575.064,21.8362 575.169,21.7042 575.274,21.5738 575.379,21.4451 575.484,21.3179 575.589,21.1924 575.694,21.0685 575.799,20.9462 575.904,20.8255 576.009,20.7064 \n",
       "  576.114,20.589 576.219,20.4731 576.324,20.3589 576.429,20.2463 576.534,20.1353 576.64,20.026 576.745,19.9182 576.85,19.8121 576.955,19.7076 577.06,19.6047 \n",
       "  577.165,19.5035 577.27,19.4038 577.375,19.3058 577.48,19.2094 577.585,19.1147 577.69,19.0215 577.795,18.93 577.9,18.8402 578.005,18.7519 578.11,18.6653 \n",
       "  578.215,18.5803 578.32,18.4969 578.425,18.4152 578.53,18.3351 578.635,18.2566 578.74,18.1798 578.845,18.1046 578.95,18.031 579.055,17.9591 579.16,17.8888 \n",
       "  579.265,17.8202 579.37,17.7531 579.475,17.6878 579.58,17.624 579.685,17.5619 579.79,17.5014 579.895,17.4426 580,17.3854 580.105,17.3299 580.21,17.276 \n",
       "  580.315,17.2237 \n",
       "  \"/>\n",
       "<polygon clip-path=\"url(#clip4000)\" points=\"\n",
       "454.157,62.931 562.315,62.931 562.315,32.691 454.157,32.691 \n",
       "  \" fill=\"#ffffff\" fill-opacity=\"1\"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#000000; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  454.157,62.931 562.315,62.931 562.315,32.691 454.157,32.691 454.157,62.931 \n",
       "  \"/>\n",
       "<polyline clip-path=\"url(#clip4000)\" style=\"stroke:#009af9; stroke-width:1; stroke-opacity:1; fill:none\" points=\"\n",
       "  460.157,47.811 496.157,47.811 \n",
       "  \"/>\n",
       "<g clip-path=\"url(#clip4000)\">\n",
       "<text style=\"fill:#000000; fill-opacity:1; font-family:Arial,Helvetica Neue,Helvetica,sans-serif; font-size:12; text-anchor:start;\" transform=\"rotate(0, 502.157, 52.311)\" x=\"502.157\" y=\"52.311\">Shoulder</text>\n",
       "</g>\n",
       "</svg>\n"
      ]
     },
     "execution_count": 11,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "shoulder_angles = collect(q[1] for q in qs)\n",
    "plot(ts, shoulder_angles, \n",
    "    xlabel = \"Time [s]\", \n",
    "    ylabel = \"Angle [rad]\", \n",
    "    label = \"Shoulder\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# The basic design of  `Mechanism` and `MechanismState`"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A `Mechanism` is an interconnection of rigid bodies and joints, without any state information:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "4-element Array{RigidBodyDynamics.RigidBody{Float64},1}:\n",
       " world     \n",
       " base_link \n",
       " upper_link\n",
       " lower_link"
      ]
     },
     "execution_count": 12,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "bodies(doublependulum)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "3-element Array{RigidBodyDynamics.Joint{Float64,JT} where JT<:RigidBodyDynamics.JointType{Float64},1}:\n",
       " base_link_to_world\n",
       " shoulder          \n",
       " elbow             "
      ]
     },
     "execution_count": 13,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "joints(doublependulum)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can unpack the list of joints into separate variables as follows:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 14,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "fixedjoint = Joint \"base_link_to_world\": Fixed joint\n",
      "shoulder = Joint \"shoulder\": Revolute joint with axis [0.0, 1.0, 0.0]\n",
      "elbow = Joint \"elbow\": Revolute joint with axis [0.0, 1.0, 0.0]\n"
     ]
    }
   ],
   "source": [
    "fixedjoint, shoulder, elbow = joints(doublependulum)\n",
    "@show fixedjoint shoulder elbow;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A `MechanismState` has all the state information, e.g. the configurations and velocities of all the joints:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 15,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "q = [0.969077, -1.51322]\n",
      "v = [0.293823, 0.0921139]\n"
     ]
    }
   ],
   "source": [
    "q = configuration(state)\n",
    "v = velocity(state)\n",
    "@show q v;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can index into these vectors either using integer indices:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 16,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "0.9690765278985414"
      ]
     },
     "execution_count": 16,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q[1]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "But also using joints:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "1-element SubArray{Float64,1,Array{Float64,1},Tuple{UnitRange{Int64}},true}:\n",
       " 0.969077"
      ]
     },
     "execution_count": 17,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q[shoulder]"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A `MechanismState` also has various cached computation results meant to reduce double work while computing various kinematic/dynamic quantities."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Kinematics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Many objects have frame annotations in the form of `CartesianFrame3D` objects:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 18,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CartesianFrame3D: \"after_elbow\" (id = 8)"
      ]
     },
     "execution_count": 18,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "frame_after(elbow)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 19,
   "metadata": {},
   "outputs": [],
   "source": [
    "setelement!(vis, frame_after(elbow));"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 20,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "CartesianFrame3D: \"before_shoulder\" (id = 4)"
      ]
     },
     "execution_count": 20,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "frame_before(shoulder)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 21,
   "metadata": {},
   "outputs": [],
   "source": [
    "setelement!(vis, frame_before(shoulder));"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here's how you create a point in the frame after the elbow joint:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 22,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Point3D in \"after_elbow\": [0.0, 0.0, -2.0]"
      ]
     },
     "execution_count": 22,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p = Point3D(frame_after(elbow), 0.0, 0.0, -2.0)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 23,
   "metadata": {},
   "outputs": [],
   "source": [
    "radius = 0.1\n",
    "setelement!(vis, p, radius, \"tip\");"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Transform it to world frame in the current state:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 24,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Point3D in \"world\": [0.211004, 0.25, -2.27721]"
      ]
     },
     "execution_count": 24,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "p = transform(state, p, root_frame(doublependulum))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now suppose we have a displacement we defined in `elbow.frameAfter`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 25,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "FreeVector3D in \"after_elbow\": [2.0, 3.0, 4.0]"
      ]
     },
     "execution_count": 25,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "displacement = FreeVector3D(frame_after(elbow), 2., 3., 4.)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "and we want to add it to `p`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 26,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "failed!\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "ArgumentError(\"p.frame: \\\"world\\\" (id = 0) ≠ v.frame: \\\"after_elbow\\\" (id = 8)\")"
      ]
     },
     "execution_count": 26,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "try\n",
    "    p + displacement\n",
    "catch err\n",
    "    println(\"failed!\")\n",
    "    err\n",
    "end"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "**Exercise for the reader:** How can you fix this? "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "You can also ask for the homogeneous transform to world:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 27,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Transform3D from \"after_elbow\" to \"world\":\n",
       "rotation: 0.5441416196451528 rad about [0.0, -1.0, 0.0], translation: [-0.824363, 0.25, -0.566061]"
      ]
     },
     "execution_count": 27,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "T = transform_to_root(state, frame_after(elbow))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Or a relative transform:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 28,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Transform3D from \"after_elbow\" to \"after_shoulder\":\n",
       "rotation: 1.513218147543694 rad about [0.0, -1.0, 0.0], translation: [0.0, 0.1, -1.0]"
      ]
     },
     "execution_count": 28,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "relative_transform(state, frame_after(elbow), frame_after(shoulder))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here's the center of mass of the double pendulum in the given state:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 29,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Point3D in \"world\": [-0.359431, 0.2, -0.852332]"
      ]
     },
     "execution_count": 29,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "center_of_mass(state)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Motion between bodies is represented using `Twist`s:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 30,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Twist of \"after_elbow\" w.r.t \"before_shoulder\" in \"world\":\n",
       "angular: [0.0, 0.385937, 0.0], linear: [0.0521421, 0.0, -0.0759353]"
      ]
     },
     "execution_count": 30,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "twist = relative_twist(state, frame_after(elbow), frame_before(shoulder))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "And you can transform these to a different frame in similar fashion:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 31,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "Twist of \"after_elbow\" w.r.t \"before_shoulder\" in \"after_elbow\":\n",
       "angular: [0.0, 0.385937, 0.0], linear: [-0.0169085, 0.0, 0.293336]"
      ]
     },
     "execution_count": 31,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "transform(state, twist, frame_after(elbow))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Dynamics"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "A `MechanismState` can also be used to compute quantities related to the dynamics of the `Mechanism`. Here we compute the mass matrix:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 32,
   "metadata": {
    "scrolled": true
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2×2 Symmetric{Float64,Array{Float64,2}}:\n",
       " 2.77809  1.38755\n",
       " 1.38755  1.33   "
      ]
     },
     "execution_count": 32,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "M = mass_matrix(state)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Here's the documentation for `mass_matrix` by the way:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 33,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "search: \u001b[1mm\u001b[22m\u001b[1ma\u001b[22m\u001b[1ms\u001b[22m\u001b[1ms\u001b[22m\u001b[1m_\u001b[22m\u001b[1mm\u001b[22m\u001b[1ma\u001b[22m\u001b[1mt\u001b[22m\u001b[1mr\u001b[22m\u001b[1mi\u001b[22m\u001b[1mx\u001b[22m \u001b[1mm\u001b[22m\u001b[1ma\u001b[22m\u001b[1ms\u001b[22m\u001b[1ms\u001b[22m\u001b[1m_\u001b[22m\u001b[1mm\u001b[22m\u001b[1ma\u001b[22m\u001b[1mt\u001b[22m\u001b[1mr\u001b[22m\u001b[1mi\u001b[22m\u001b[1mx\u001b[22m!\n",
      "\n"
     ]
    },
    {
     "data": {
      "text/markdown": [
       "```julia\n",
       "mass_matrix(state)\n",
       "\n",
       "```\n",
       "\n",
       "Compute the joint-space mass matrix (also known as the inertia matrix) of the `Mechanism` in the given state, i.e., the matrix $M(q)$ in the unconstrained joint-space equations of motion\n",
       "\n",
       "$$\n",
       "M(q) \\dot{v} + c(q, v, w_\\text{ext}) = \\tau\n",
       "$$\n",
       "\n",
       "This method implements the composite rigid body algorithm.\n"
      ],
      "text/plain": [
       "```julia\n",
       "mass_matrix(state)\n",
       "\n",
       "```\n",
       "\n",
       "Compute the joint-space mass matrix (also known as the inertia matrix) of the `Mechanism` in the given state, i.e., the matrix $M(q)$ in the unconstrained joint-space equations of motion\n",
       "\n",
       "$$\n",
       "M(q) \\dot{v} + c(q, v, w_\\text{ext}) = \\tau\n",
       "$$\n",
       "\n",
       "This method implements the composite rigid body algorithm.\n"
      ]
     },
     "execution_count": 33,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "?mass_matrix"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Note that there is also a zero-allocation version, `mass_matrix!`:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 34,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "2×2 Symmetric{Float64,Array{Float64,2}}:\n",
       " 2.77809  1.38755\n",
       " 1.38755  1.33   "
      ]
     },
     "execution_count": 34,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "mass_matrix!(M, state)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "(the `!` at the end of a method is a Julia convention signifying that the function is 'in-place', i.e. modifies its input data)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 35,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "  1.853 μs (0 allocations: 0 bytes)\n"
     ]
    },
    {
     "data": {
      "text/plain": [
       "2×2 Symmetric{Float64,Array{Float64,2}}:\n",
       " 2.77809  1.38755\n",
       " 1.38755  1.33   "
      ]
     },
     "execution_count": 35,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "using BenchmarkTools\n",
    "@btime (setdirty!($state); mass_matrix!($M, $state))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "*Note*: see http://www.juliarobotics.org/RigidBodyDynamics.jl/stable/benchmarks.html for tips on how to get maximal performance."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "We can do inverse dynamics as follows (note again that there is a non-allocating version of this method as well):"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "τ = [16.8334, 1.60042]\n"
     ]
    }
   ],
   "source": [
    "v̇ = similar(velocity(state))\n",
    "v̇ .= [2.; 3.] # the joint acceleration vector, i.e., the time derivative of the joint velocity vector v\n",
    "τ = inverse_dynamics(state, v̇)\n",
    "@show τ;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "For forward dynamics, one first creates a `DynamicsResult` object, which preallocates a bunch of stuff:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {},
   "outputs": [],
   "source": [
    "result = DynamicsResult{Float64}(doublependulum);"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {},
   "outputs": [],
   "source": [
    "dynamics!(result, state)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {},
   "outputs": [
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "result.v̇ = [-9.3969, 13.6867]\n"
     ]
    }
   ],
   "source": [
    "@show result.v̇;"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Combining RigidBodyDynamics with Other Tools\n",
    "\n",
    "RigidBodyDynamics.jl is a good component for robotics development, but it becomes much more useful when we compose it with other Julia tools. Julia makes it very easy to create generic types and functions that work well with types and functions from other packages to create new behaviors. \n",
    "\n",
    "To demonstrate this flexibility, we'll try doing the following:\n",
    "\n",
    "* Computing symbolic quantities with SymPy.jl\n",
    "* Revisiting automatic differentiation with ForwardDiff.jl\n",
    "* Propagating uncertainty with Measurements.jl (see the next notebook)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Symbolic Quantities\n",
    "\n",
    "We can get symbolic representations of the kinematics and dynamics of a robot by simply constructing an appropriate mechanism or state. In this case, we'll use [SymPy.jl](https://github.com/JuliaPy/SymPy.jl) which is simply a nice Julia wrapper around the SymPy Python package. "
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Setup"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "SymPy is a wrapper around a Python package, and installing Python packages can be [complicated](https://xkcd.com/1987/). If SymPy plays poorly with your current Python installation, you can ask Julia to use a private, self-contained version of Python powered by [Conda](https://github.com/JuliaPy/Conda.jl). To do that, you can just run: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001b[1m\u001b[36mINFO: \u001b[39m\u001b[22m\u001b[36mBuilding SpecialFunctions\n",
      "\u001b[39m\u001b[1m\u001b[36mINFO: \u001b[39m\u001b[22m\u001b[36mBuilding Conda\n",
      "\u001b[39m\u001b[1m\u001b[36mINFO: \u001b[39m\u001b[22m\u001b[36mBuilding PyCall\n",
      "\u001b[39m\u001b[1m\u001b[36mInfo: \u001b[39m\u001b[22m\u001b[36mUsing the Python distribution in the Conda package by default.\n",
      "To use a different Python version, set ENV[\"PYTHON\"]=\"pythoncommand\" and re-run Pkg.build(\"PyCall\").\n",
      "\u001b[39m"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "Solving environment: ...working... done\n",
      "\n",
      "# All requested packages already installed.\n",
      "\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "\u001b[1m\u001b[36mInfo: \u001b[39m\u001b[22m\u001b[36mPyCall is using /Users/twan/code/julia/tutorial/v0.6/Conda/deps/usr/bin/python (Python 2.7.14) at /Users/twan/code/julia/tutorial/v0.6/Conda/deps/usr/bin/python, libpython = /Users/twan/code/julia/tutorial/v0.6/Conda/deps/usr/lib/libpython2.7\n",
      "\u001b[39m\u001b[1m\u001b[36mInfo: \u001b[39m\u001b[22m\u001b[36m/Users/twan/code/julia/tutorial/v0.6/PyCall/deps/deps.jl has not changed\n",
      "\u001b[39m\u001b[1m\u001b[36mInfo: \u001b[39m\u001b[22m\u001b[36m/Users/twan/code/julia/tutorial/v0.6/PyCall/deps/PYTHON has not changed\n",
      "\u001b[39m"
     ]
    }
   ],
   "source": [
    "# Make SymPy use version of Python downloaded through Julia's package system instead of system Python\n",
    "ENV[\"PYTHON\"]=\"\"\n",
    "Pkg.build(\"SymPy\")"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "With Python successfully self-contained, we can now import the SymPy.jl package:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "WARNING: using SymPy.transform in module Main conflicts with an existing identifier.\n"
     ]
    }
   ],
   "source": [
    "using SymPy"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "To get a symbolic expression for the mass matrix of the double pendulum in terms of its configuration and velociy, we simply need to create symbolic quantities for q and v: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "(v1, v2)"
      ]
     },
     "execution_count": 42,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@syms q1 q2 real=true\n",
    "@syms v1 v2 real=true"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/latex": [
       "\\begin{bmatrix}2.0 \\cos{\\left (q_{2} \\right )} + 2.663&1.0 \\cos{\\left (q_{2} \\right )} + 1.33\\\\1.0 \\cos{\\left (q_{2} \\right )} + 1.33&1.33\\end{bmatrix}"
      ],
      "text/plain": [
       "2×2 Array{SymPy.Sym,2}:\n",
       " 2.0*cos(q2) + 2.663  1.0*cos(q2) + 1.33\n",
       "  1.0*cos(q2) + 1.33    1.33000000000000"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q = [q1, q2]\n",
    "v = [v1, v2]\n",
    "\n",
    "simplify.(mass_matrix(MechanismState(doublependulum, q, v)))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "*Note*: you can also have symbolic parameters (masses, lengths, etc.). See [this notebook](https://github.com/JuliaRobotics/RigidBodyDynamics.jl/blob/master/notebooks/Symbolic%20double%20pendulum.ipynb)."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "## Automatic Differentiation\n",
    "\n",
    "A very common task in robotics is computing the derivative, gradient, or Jacobian of some quantity with respect to some other quantity. \n",
    "\n",
    "For example, suppose we want the Jacobian of momentum with respect to the joint velocity vector $v$. We can do this using the `ForwardDiff.Dual` type and the `ForwardDiff.jacobian` function.\n",
    "\n",
    "First, we need to write a function that computes the quantity we're interested in, as a function of $v$: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "mom (generic function with 1 method)"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "q = configuration(state)\n",
    "v = velocity(state)\n",
    "\n",
    "function mom(v::AbstractVector)\n",
    "    # create a `MechanismState` that can handle the element type of `v` (which will be some `ForwardDiff.Dual`):\n",
    "    state = MechanismState{eltype(v)}(doublependulum)\n",
    "    \n",
    "    # set the state variables:\n",
    "    set_configuration!(state, q)\n",
    "    set_velocity!(state, v)\n",
    "    \n",
    "    # return momentum converted to an `Array` (as this is the format that ForwardDiff expects)\n",
    "    Array(momentum(state))\n",
    "end"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "First, let's test `mom()` against the existing `momentum` function: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[1m\u001b[32mTest Passed\u001b[39m\u001b[22m"
      ]
     },
     "execution_count": 45,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@test mom(v) == Array(momentum(state))"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Computing the Jacobian is just a matter of calling `ForwardDiff.jacobian`: "
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {},
   "outputs": [],
   "source": [
    "using ForwardDiff"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "6×2 Array{Float64,2}:\n",
       "  0.138497  -0.129421\n",
       "  2.77809    1.38755 \n",
       "  0.397863   0.213893\n",
       " -1.70466   -0.855572\n",
       "  0.0        0.0     \n",
       "  0.718861  -0.517684"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "J = ForwardDiff.jacobian(mom, v)"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "At this point we note that the matrix $J$ is simply the momentum matrix (in world frame) of the Mechanism. In this case, [RigidBodyDynamics.jl](https://github.com/JuliaRobotics/RigidBodyDynamics.jl) has a specialized algorithm for computing this matrix, so let's verify the results:"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/plain": [
       "\u001b[1m\u001b[32mTest Passed\u001b[39m\u001b[22m"
      ]
     },
     "execution_count": 48,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "@test J ≈ Array(momentum_matrix(state)) atol = 1e-12"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "### Improving Performance\n",
    "\n",
    "The naive implementation of `mom()` above will be somewhat slow, in part because it will construct a brand-new MechanismState every time. To learn more about improving performance of ForwardDiff with RigidBodyDynamics, see: https://github.com/JuliaRobotics/RigidBodyDynamics.jl/blob/master/notebooks/Derivatives%20and%20gradients%20using%20ForwardDiff.ipynb"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Now we've covered symbolics and autodiff. For a demonstration of uncertainty propagation, check out the next notebook..."
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# More info"
   ]
  },
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "Documentation is available at http://www.juliarobotics.org/RigidBodyDynamics.jl/stable/.\n",
    "\n",
    "More example notebooks can be found [here](https://github.com/JuliaRobotics/RigidBodyDynamics.jl/tree/master/notebooks). These examples include:\n",
    "\n",
    "* creating a four-bar linkage (kinematic loops implemented using Lagrange multipliers)\n",
    "* basic simulation with a controller in the loop (but see [RigidBodySim.jl](https://github.com/JuliaRobotics/RigidBodySim.jl) for a more full-fledged implementation).\n",
    "* computing guaranteed error bounds by combining RigidBodyDynamics.jl with [IntervalArithmetic.jl](https://github.com/JuliaIntervals/IntervalArithmetic.jl)."
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Julia 0.6.2",
   "language": "julia",
   "name": "julia-0.6"
  },
  "language_info": {
   "file_extension": ".jl",
   "mimetype": "application/julia",
   "name": "julia",
   "version": "0.6.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 1
}
